File tree Expand file tree Collapse file tree 4 files changed +48
-0
lines changed
regression/cbmc/pragma_cprover2 Expand file tree Collapse file tree 4 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ int foo (int x )
2
+ {
3
+ return x ;
4
+ }
5
+
6
+ int main ()
7
+ {
8
+ int n ;
9
+
10
+ #pragma CPROVER check push
11
+ #pragma CPROVER check disable "signed-overflow"
12
+ // do not generate assertions for the following statements
13
+ int x = n + n ;
14
+ ++ n ;
15
+ n ++ ;
16
+ n += 1 ;
17
+ foo (x + n );
18
+ // pop all annotations
19
+ #pragma CPROVER check pop
20
+ // but do generate assertions for these
21
+ x = n + n ;
22
+ foo (x + n );
23
+ return x ;
24
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --signed-overflow-check
4
+ ^\[main.overflow\.1\] line 21 arithmetic overflow on signed \+ in n \+ n: FAILURE$
5
+ ^\[main.overflow\.2\] line 22 arithmetic overflow on signed \+ in x \+ n: FAILURE$
6
+ ^\*\* 2 of 2 failed
7
+ ^VERIFICATION FAILED$
8
+ ^EXIT=10$
9
+ ^SIGNAL=0$
10
+ --
11
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -243,7 +243,16 @@ void c_typecheck_baset::typecheck_decl(codet &code)
243
243
}
244
244
245
245
ansi_c_declarationt declaration;
246
+ irep_idt comment = code.source_location ().get_comment ();
246
247
declaration.swap (code.op0 ());
248
+ if (!comment.empty ())
249
+ {
250
+ for (auto &d : declaration.declarators ())
251
+ {
252
+ if (d.source_location ().get_comment ().empty ())
253
+ d.add_source_location ().set_comment (comment);
254
+ }
255
+ }
247
256
248
257
if (declaration.get_is_static_assert ())
249
258
{
Original file line number Diff line number Diff line change @@ -2019,6 +2019,10 @@ void c_typecheck_baset::typecheck_side_effect_function_call(
2019
2019
throw 0 ;
2020
2020
}
2021
2021
2022
+ irep_idt comment = expr.source_location ().get_comment ();
2023
+ if (!comment.empty () && f_op.source_location ().get_comment ().empty ())
2024
+ f_op.add_source_location ().set_comment (comment);
2025
+
2022
2026
const code_typet &code_type=to_code_type (f_op.type ());
2023
2027
2024
2028
expr.type ()=code_type.return_type ();
You can’t perform that action at this time.
0 commit comments