Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added jbmc/regression/jbmc/JumpSimplification/Test.class
Binary file not shown.
14 changes: 14 additions & 0 deletions jbmc/regression/jbmc/JumpSimplification/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class Test {

public int foo(int i) {
int x = 0;
if (i > 0) {
x++;
}
else
{
x--;
}
return x + 1000;
}
}
10 changes: 10 additions & 0 deletions jbmc/regression/jbmc/JumpSimplification/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
Test.class
--show-goto-functions --function Test.foo
activate-multi-line-match
EXIT=0
SIGNAL=0
IF \w* <= 0 THEN GOTO 1\n\s*//.*\n\s*//.*\n\s*\w*::
--
IF !\(\w* <= 0\) THEN GOTO 1\n\s*//.*\n.*GOTO 2\n\s*//.*\n\s*//.*\n\s*1: \w*::
^warning: ignoring
6 changes: 4 additions & 2 deletions src/goto-programs/goto_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1460,8 +1460,10 @@ void goto_convertt::convert_goto(
const codet &code,
goto_programt &dest)
{
// this instruction will turn into a goto during post-processing
goto_programt::targett t=dest.add_instruction(NO_INSTRUCTION_TYPE);
// this instruction will be completed during post-processing
// it is required to mark this as GOTO in order to enable
// simplifications in generate_ifthenelse
goto_programt::targett t = dest.add_instruction(GOTO);
t->source_location=code.source_location();
t->code=code;

Expand Down