File tree Expand file tree Collapse file tree 11 files changed +144
-14
lines changed Expand file tree Collapse file tree 11 files changed +144
-14
lines changed Original file line number Diff line number Diff line change
1
+ default : tests.log
2
+
3
+ test :
4
+ @if ! ../test.pl -c ../../../src/cbmc/cbmc ; then \
5
+ ../failed-tests-printer.pl ; \
6
+ exit 1 ; \
7
+ fi
8
+
9
+ tests.log : ../test.pl
10
+ @if ! ../test.pl -c ../../../src/cbmc/cbmc ; then \
11
+ ../failed-tests-printer.pl ; \
12
+ exit 1 ; \
13
+ fi
14
+
15
+ show :
16
+ @for dir in * ; do \
17
+ if [ -d " $$ dir" ]; then \
18
+ vim -o " $$ dir/*.c" " $$ dir/*.out" ; \
19
+ fi ; \
20
+ done ;
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int input1 , input2 ;
4
+
5
+ if (input1 )
6
+ {
7
+ if (input1 ) // dependent
8
+ {
9
+ }
10
+ }
11
+ else
12
+ {
13
+ if (input2 ) // independent
14
+ {
15
+ }
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --cover branch
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^\[main.1\] file main.c line 5 function main function main block 1 branch false: SATISFIED$
7
+ ^\[main.2\] file main.c line 5 function main function main block 1 branch true: SATISFIED$
8
+ ^\[main.3\] file main.c line 7 function main function main block 2 branch false: FAILED$
9
+ ^\[main.4\] file main.c line 7 function main function main block 2 branch true: SATISFIED$
10
+ ^\[main.5\] file main.c line 13 function main function main block 4 branch false: SATISFIED$
11
+ ^\[main.6\] file main.c line 13 function main function main block 4 branch true: SATISFIED$
12
+ --
13
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int input1 , input2 ;
4
+
5
+ if (input1 && input2 )
6
+ {
7
+ }
8
+ else if (input1 )
9
+ {
10
+ }
11
+ else if (input2 )
12
+ {
13
+ if (input1 ) // can't be true
14
+ {
15
+ }
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --cover condition
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^\[main.1] file main.c line 5 function main condition .* false: SATISFIED
7
+ ^\[main.2] file main.c line 5 function main condition .* true: SATISFIED
8
+ ^\[main.3] file main.c line 5 function main condition .* false: SATISFIED
9
+ ^\[main.4] file main.c line 5 function main condition .* true: SATISFIED
10
+ ^\[main.5] file main.c line 8 function main condition .* false: SATISFIED
11
+ ^\[main.6] file main.c line 8 function main condition .* true: SATISFIED
12
+ ^\[main.7] file main.c line 11 function main condition .* false: SATISFIED
13
+ ^\[main.8] file main.c line 11 function main condition .* true: SATISFIED
14
+ ^\[main.9] file main.c line 13 function main condition .* false: FAILED
15
+ ^\[main.10] file main.c line 13 function main condition .* true: SATISFIED
16
+ ^\*\* 9 of 10 covered (90.0%)
17
+ --
18
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int input1 , input2 , input3 ;
4
+
5
+ if (input1 && input2 && input3 )
6
+ {
7
+ }
8
+ else
9
+ {
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --cover decision
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^\*\* 2 of 2 covered (100.0%), using 2 iterations$
7
+ --
8
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ int main ()
2
+ {
3
+ int input1 ;
4
+ int x = 0 ;
5
+
6
+ if (input1 )
7
+ {
8
+ x = 1 ;
9
+ }
10
+
11
+ if (input1 && !x )
12
+ {
13
+ x = 2 ; // I am dead!
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --cover location
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^\[main.1\] file main.c line 3 function main block 1: SATISFIED$
7
+ ^\[main.2\] file main.c line 8 function main block 2: SATISFIED$
8
+ ^\[main.3\] file main.c line 11 function main block 3: SATISFIED$
9
+ ^\[main.4\] file main.c line 13 function main block 4: FAILED$
10
+ ^\[main.5\] file main.c line 15 function main block 5: SATISFIED$
11
+ ^\*\* 4 of 5 covered (80.0%)
12
+ --
13
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -272,33 +272,33 @@ bool bmc_covert::operator()()
272
272
i_it->source_location );
273
273
}
274
274
}
275
+
276
+ for (symex_target_equationt::SSA_stepst::iterator
277
+ it=bmc.equation .SSA_steps .begin ();
278
+ it!=bmc.equation .SSA_steps .end ();
279
+ it++)
280
+ it->cond_literal =literalt (0 , 0 );
275
281
276
282
// Do conversion to next solver layer
277
283
278
284
bmc.do_conversion ();
279
285
280
286
// bmc.equation.output(std::cout);
281
287
282
- // collects assumptions
283
- and_exprt::operandst assumptions;
284
-
285
288
// get the conditions for these goals from formula
286
289
// collect all 'instances' of the goals
287
290
for (symex_target_equationt::SSA_stepst::iterator
288
291
it=bmc.equation .SSA_steps .begin ();
289
292
it!=bmc.equation .SSA_steps .end ();
290
293
it++)
291
294
{
292
- if (it->is_assume ())
293
- assumptions.push_back (literal_exprt (it->cond_literal ));
294
-
295
- if (it->source .pc ->is_assert ())
295
+ if (it->is_assert ())
296
296
{
297
+ assert (it->source .pc ->is_assert ());
297
298
exprt c=
298
299
conjunction ({
299
- conjunction (assumptions),
300
300
literal_exprt (it->guard_literal ),
301
- literal_exprt (it->cond_literal ) });
301
+ literal_exprt (! it->cond_literal ) });
302
302
literalt l_c=solver.convert (c);
303
303
goal_map[id (it->source .pc )].add_instance (it, l_c);
304
304
}
Original file line number Diff line number Diff line change @@ -301,9 +301,7 @@ void instrument_cover_goals(
301
301
if (!source_location.get_file ().empty () &&
302
302
source_location.get_file ()[0 ]!=' <' )
303
303
{
304
- std::string comment=
305
- " block " +i2string (i_it->location_number );
306
-
304
+ std::string comment=" block " +b;
307
305
goto_program.insert_before_swap (i_it);
308
306
i_it->make_assertion (false_exprt ());
309
307
i_it->source_location =source_location;
@@ -328,12 +326,12 @@ void instrument_cover_goals(
328
326
source_locationt source_location=i_it->source_location ;
329
327
330
328
goto_program.insert_before_swap (i_it);
331
- i_it->make_assertion (guard);
329
+ i_it->make_assertion (not_exprt ( guard) );
332
330
i_it->source_location =source_location;
333
331
i_it->source_location .set_comment (true_comment);
334
332
335
333
goto_program.insert_before_swap (i_it);
336
- i_it->make_assertion (not_exprt ( guard) );
334
+ i_it->make_assertion (guard);
337
335
i_it->source_location =source_location;
338
336
i_it->source_location .set_comment (false_comment);
339
337
You can’t perform that action at this time.
0 commit comments