forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also simplify assert structure found on alpine linux
- Loading branch information
1 parent
c5cde18
commit d44bfd3
Showing
2 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,7 @@ Author: Daniel Kroening, [email protected] | |
static bool is_empty(const goto_programt &goto_program) | ||
{ | ||
forall_goto_program_instructions(it, goto_program) | ||
if(!it->is_skip() || | ||
!it->labels.empty() || | ||
!it->code.is_nil()) | ||
if(!is_skip(goto_program, it)) | ||
return false; | ||
|
||
return true; | ||
|
@@ -1749,6 +1747,23 @@ void goto_convertt::generate_ifthenelse( | |
return; | ||
} | ||
|
||
// a special case for C libraries that use | ||
// (void)((cond) || (assert(0),0)) | ||
if( | ||
is_empty(false_case) && true_case.instructions.size() == 2 && | ||
true_case.instructions.front().is_assert() && | ||
true_case.instructions.front().guard.is_false() && | ||
true_case.instructions.front().labels.empty() && | ||
true_case.instructions.back().labels.empty()) | ||
{ | ||
true_case.instructions.front().guard = boolean_negate(guard); | ||
true_case.instructions.erase(--true_case.instructions.end()); | ||
dest.destructive_append(true_case); | ||
true_case.instructions.clear(); | ||
|
||
return; | ||
} | ||
|
||
// Flip around if no 'true' case code. | ||
if(is_empty(true_case)) | ||
return generate_ifthenelse( | ||
|