File tree Expand file tree Collapse file tree 3 files changed +50
-4
lines changed
regression/ansi-c/contracts_scope1 Expand file tree Collapse file tree 3 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 1+ #define C 8
2+
3+ typedef unsigned st [C ];
4+
5+ // clang-format off
6+ void init_st (st dst )
7+ __CPROVER_requires (__CPROVER_is_fresh (dst , sizeof (st )))
8+ __CPROVER_assigns (__CPROVER_object_whole (dst ))
9+ __CPROVER_ensures (__CPROVER_forall {
10+ unsigned i ; (0 <= i && i < C ) == > dst [i ] == 0
11+ });
12+ // clang-format on
13+
14+ void init_st (st dst )
15+ {
16+ __CPROVER_size_t i ;
17+ for (i = 0 ; i < C ; i ++ )
18+ {
19+ dst [i ] = 0 ;
20+ }
21+ }
22+
23+ int main ()
24+ {
25+ st dest ;
26+
27+ init_st (dest );
28+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ --
7+ ^warning: ignoring
8+ ^CONVERSION ERROR$
Original file line number Diff line number Diff line change @@ -3337,17 +3337,27 @@ parameter_abstract_declarator:
33373337 ;
33383338
33393339cprover_function_contract:
3340- TOK_CPROVER_ENSURES ' (' ACSL_binding_expression ' )'
3340+ TOK_CPROVER_ENSURES
3341+ {
3342+ PARSER.new_scope (" ensures::" );
3343+ }
3344+ ' (' ACSL_binding_expression ' )'
33413345 {
33423346 $$=$1 ;
33433347 set ($$, ID_C_spec_ensures);
3344- mto ($$, $3 );
3348+ mto ($$, $4 );
3349+ PARSER.pop_scope ();
33453350 }
3346- | TOK_CPROVER_REQUIRES ' (' ACSL_binding_expression ' )'
3351+ | TOK_CPROVER_REQUIRES
3352+ {
3353+ PARSER.new_scope (" requires::" );
3354+ }
3355+ ' (' ACSL_binding_expression ' )'
33473356 {
33483357 $$=$1 ;
33493358 set ($$, ID_C_spec_requires);
3350- mto ($$, $3 );
3359+ mto ($$, $4 );
3360+ PARSER.pop_scope ();
33513361 }
33523362 | cprover_contract_assigns
33533363 | cprover_contract_frees
You can’t perform that action at this time.
0 commit comments