File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
regression/goto-instrument/constant-propagation-function-call Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ int ab , bc ;
3
+ int f (int x )
4
+ {
5
+ ab = 1 + 1 + 1 + 1 ;
6
+ bc = ab + x ;
7
+ return ab + bc ;
8
+ }
9
+ int main ()
10
+ {
11
+ int a ;
12
+ a = -4 ;
13
+ int b ;
14
+ b = nondet ();
15
+ a = f (a );
16
+ assert (!(0 <= a && a < 5 && 0 <= b && b < 5 ));
17
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --constant-propagator
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ VERIFICATION FAILED
7
+ ASSIGN main\:\:1\:\:a \:\= 4
8
+ ASSERT ¬\(main::1::b ≥ 0\) ∨ main::1::b ≥ 5
9
+ --
10
+ ^warning: ignoring
11
+ ASSERT true
12
+ --
13
+ This tests that constants are propagated through function calls, correctly
14
+ taking into account the return value. Constant propagation should result in
15
+ simplifying away the conditions in the assertion on `a` but not the conditions
16
+ on `b`.
You can’t perform that action at this time.
0 commit comments