Skip to content

Commit

Permalink
Added missing c elements
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeBajczi committed Jul 25, 2023
1 parent 7d3d9bc commit 57aae56
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class FrontendXcfaBuilder(val parseContext: ParseContext, val checkOverflow: Boo
val breakLoc = param.breakLoc
val continueLoc = param.continueLoc
val returnLoc = param.returnLoc
return statement.accept(this, ParamPack(builder, lastLoc, breakLoc, continueLoc, returnLoc))
return statement.statement.accept(this, ParamPack(builder, lastLoc, breakLoc, continueLoc, returnLoc))
}

override fun visit(statement: CCompound, param: ParamPack): XcfaLocation {
Expand Down Expand Up @@ -417,7 +417,7 @@ class FrontendXcfaBuilder(val parseContext: ParseContext, val checkOverflow: Boo
val breakLoc = param.breakLoc
val continueLoc = param.continueLoc
val returnLoc = param.returnLoc
return statement.accept(this, ParamPack(builder, lastLoc, breakLoc, continueLoc, returnLoc))
return statement.statement.accept(this, ParamPack(builder, lastLoc, breakLoc, continueLoc, returnLoc))
}

override fun visit(statement: CDoWhile, param: ParamPack): XcfaLocation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class TestFrontendXcfaBuilder {
arrayOf("/20testinline.c"),
arrayOf("/21namecollision.c"),
arrayOf("/22nondet.c"),
arrayOf("/23exotic.c"),
)
}
}
Expand Down
20 changes: 20 additions & 0 deletions subprojects/xcfa/c2xcfa/src/test/resources/23exotic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
extern unsigned int __VERIFIER_nondet_uint();
int main() {
int i = 0;
do{
unsigned int add = __VERIFIER_nondet_uint();
switch(add) {
case 0:
break;
case 1:
i += add;
break;
default:
i += 1;
break;
}
if ( i == 5) continue;
if ( i == 11) break;
} while(i < 10);
if(i < 10) reach_error();
}

0 comments on commit 57aae56

Please sign in to comment.