-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33aee5a
commit 3c0ff8c
Showing
2 changed files
with
73 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// PARAM: --enable ana.int.interval_set --set ana.context.gas_value 3 --set ana.context.gas_scope function | ||
int nr(int x, int y) { | ||
// Non-recursive, but would fail with global scope as gas for f is exhausted | ||
__goblint_check(x==y); | ||
} | ||
|
||
int f(int x, int y) | ||
{ | ||
int top; | ||
if (x == 0) | ||
{ | ||
return y; | ||
} | ||
|
||
if(top) { | ||
nr(5,5); | ||
} else { | ||
nr(6,6); | ||
} | ||
|
||
return f(x - 1, y - 1); | ||
} | ||
|
||
int main() | ||
{ | ||
// main -> f(3,3) -> f(2,2) -> f(1,1) -> f(0,0) -> return 0 | ||
// 4 recursive calls -> boundary (excluded) | ||
__goblint_check(f(3, 3) == 0); // UNKNOWN | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// PARAM: --enable ana.int.interval_set --set ana.context.gas_value 3 --set ana.context.gas_scope function | ||
int nr(int x, int y) { | ||
// Non-recursive, but would fail with global scope as gas for f is exhausted | ||
__goblint_check(x==y); | ||
} | ||
|
||
// Checks that gas is also applied to further functions | ||
int g(int x, int y) | ||
{ | ||
int top; | ||
if (x < -100000) | ||
{ | ||
return y; | ||
} | ||
|
||
if(top) { | ||
nr(5,5); | ||
} else { | ||
nr(6,6); | ||
} | ||
|
||
return g(x - 1, y - 1); | ||
} | ||
|
||
int f(int x, int y) | ||
{ | ||
int top; | ||
|
||
if (x == 0) | ||
{ | ||
return y; | ||
} | ||
|
||
g(x,y); | ||
|
||
return f(x - 1, y - 1); | ||
} | ||
|
||
int main() | ||
{ | ||
// main -> f(3,3) -> f(2,2) -> f(1,1) -> f(0,0) -> return 0 | ||
// 4 recursive calls -> boundary (excluded) | ||
__goblint_check(f(3, 3) == 0); // UNKNOWN | ||
} |