File tree Expand file tree Collapse file tree 5 files changed +60
-1
lines changed
Expand file tree Collapse file tree 5 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 1+ #include "assert.h"
2+
3+ int main ()
4+ {
5+ int count = 0 ;
6+ do
7+ {
8+ count = count + 1 ;
9+ } while (count < 5 );
10+
11+ do
12+ {
13+ } while (count < 5 );
14+
15+ while (count < 5 )
16+ ;
17+
18+ assert (count == 5 );
19+ assert (count == 17 );
20+ }
Original file line number Diff line number Diff line change 1+ #include "assert.h"
2+
3+ int main ()
4+ {
5+ int count ;
6+
7+ do
8+ {
9+ } while (count < 5 );
10+
11+ while (count < 5 )
12+ ;
13+
14+ assert (count >= 5 );
15+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ requires-transform.c
3+
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ --
8+ ^warning: ignoring
9+ --
10+ This test will only terminate, if the transformation of loops to assumes by
11+ goto-symex is applied.
Original file line number Diff line number Diff line change 1+ CORE
2+ main.c
3+
4+ ^EXIT=10$
5+ ^SIGNAL=0$
6+ ^\[main.assertion.1\] line 18 assertion count == 5: SUCCESS$
7+ ^\[main.assertion.2\] line 19 assertion count == 17: FAILURE$
8+ ^VERIFICATION FAILED$
9+ --
10+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -252,9 +252,12 @@ void goto_symext::symex_goto(statet &state)
252252 // is it label: goto label; or while(cond); - popular in SV-COMP
253253 if (
254254 symex_config.self_loops_to_assumptions &&
255+ // label: goto label; or do {} while(cond);
255256 (goto_target == state.source .pc ||
257+ // while(cond);
256258 (instruction.incoming_edges .size () == 1 &&
257- *instruction.incoming_edges .begin () == goto_target)))
259+ *instruction.incoming_edges .begin () == goto_target &&
260+ goto_target->is_goto () && new_guard.is_true ())))
258261 {
259262 // generate assume(false) or a suitable negation if this
260263 // instruction is a conditional goto
You can’t perform that action at this time.
0 commit comments