File tree 3 files changed +50
-4
lines changed
regression/ansi-c/contracts_scope1
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:
3337
3337
;
3338
3338
3339
3339
cprover_function_contract:
3340
- TOK_CPROVER_ENSURES ' (' ACSL_binding_expression ' )'
3340
+ TOK_CPROVER_ENSURES
3341
+ {
3342
+ PARSER.new_scope (" ensures::" );
3343
+ }
3344
+ ' (' ACSL_binding_expression ' )'
3341
3345
{
3342
3346
$$=$1 ;
3343
3347
set ($$, ID_C_spec_ensures);
3344
- mto ($$, $3 );
3348
+ mto ($$, $4 );
3349
+ PARSER.pop_scope ();
3345
3350
}
3346
- | TOK_CPROVER_REQUIRES ' (' ACSL_binding_expression ' )'
3351
+ | TOK_CPROVER_REQUIRES
3352
+ {
3353
+ PARSER.new_scope (" requires::" );
3354
+ }
3355
+ ' (' ACSL_binding_expression ' )'
3347
3356
{
3348
3357
$$=$1 ;
3349
3358
set ($$, ID_C_spec_requires);
3350
- mto ($$, $3 );
3359
+ mto ($$, $4 );
3360
+ PARSER.pop_scope ();
3351
3361
}
3352
3362
| cprover_contract_assigns
3353
3363
| cprover_contract_frees
You can’t perform that action at this time.
0 commit comments