-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated testcases loopfreeCallstring + callstring fundec
- Loading branch information
Johanna Schinabeck
authored and
Johanna Schinabeck
committed
Feb 12, 2024
1 parent
a7bf70e
commit 6520557
Showing
42 changed files
with
902 additions
and
665 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
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
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
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
23 changes: 23 additions & 0 deletions
23
tests/regression/81-loopfree_callstring/11-value_update_sens.c
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,23 @@ | ||
// PARAM: --set "ana.activated[+]" loopfree_callstring --enable ana.int.interval_set | ||
// Basic example | ||
#include <stdio.h> | ||
|
||
int a = 20; | ||
|
||
int f(int i) | ||
{ | ||
if (i > 0) | ||
{ | ||
a = --i; | ||
f(i); | ||
} | ||
return 0; | ||
} | ||
|
||
int main(void) | ||
{ | ||
// main -> f(10) -> f(9) -> ... f(0) | ||
// [main, f] and [main] {f} | ||
f(1); | ||
__goblint_check(a == 0); | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/regression/81-loopfree_callstring/12-value_update_ins.c
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,23 @@ | ||
// PARAM: --set "ana.activated[+]" loopfree_callstring --enable ana.int.interval_set | ||
// Basic example | ||
#include <stdio.h> | ||
|
||
int a = 20; | ||
|
||
int f(int i) | ||
{ | ||
if (i > 0) | ||
{ | ||
a = --i; | ||
f(i); | ||
} | ||
return 0; | ||
} | ||
|
||
int main(void) | ||
{ | ||
// main -> f(10) -> f(9) -> ... f(0) | ||
// [main, f] and [main] {f} (2 times) | ||
f(2); | ||
__goblint_check(a == 0); // UNKNOWN | ||
} |
42 changes: 42 additions & 0 deletions
42
tests/regression/81-loopfree_callstring/13-circle_call_and_big_loop.c
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,42 @@ | ||
// PARAM: --set "ana.activated[+]" loopfree_callstring --enable ana.int.interval_set | ||
// Checks proper handling of recursions in loops + shows that not all 200 iterations are analyzed | ||
#include <stdio.h> | ||
|
||
int f(int i); | ||
|
||
int g(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 1; | ||
} | ||
if (i > 0) | ||
{ | ||
return f(i - 1); | ||
} | ||
return 11; | ||
} | ||
|
||
int f(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 2; | ||
} | ||
if (i > 0) | ||
{ | ||
return g(i - 1); | ||
} | ||
return 12; | ||
} | ||
|
||
int main(void) | ||
{ | ||
for (int i = 200; i > 0; i--) | ||
{ | ||
int res1 = f(2); | ||
int res2 = g(2); | ||
__goblint_check(res1 == 2); | ||
__goblint_check(res2 == 1); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/regression/81-loopfree_callstring/14-loop_unrolling.c
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,26 @@ | ||
// PARAM: --set "ana.activated[+]" loopfree_callstring --enable ana.int.interval_set --set exp.unrolling-factor 3 | ||
|
||
#include <stdio.h> | ||
|
||
int f(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 1; | ||
} | ||
if (i > 0) | ||
{ | ||
return f(i - 1); | ||
} | ||
return 11; | ||
} | ||
|
||
int main(void) | ||
{ | ||
for (int i = 5; i > 0; i--) | ||
{ | ||
// main -> f(3) -> ... -> f(0) -> return 1 | ||
// [main, f] and {f} (3 times) | ||
__goblint_check(f(3) == 1); | ||
} | ||
} |
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,84 @@ | ||
// PARAM: --set "ana.activated[+]" loopfree_callstring --enable ana.int.interval_set | ||
#include <pthread.h> | ||
#include <stdio.h> | ||
#include <goblint.h> | ||
|
||
int f(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 1; | ||
} | ||
if (i > 0) | ||
{ | ||
return f(i - 1); | ||
} | ||
return 11; | ||
} | ||
|
||
int g(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 3; | ||
} | ||
if (i > 0) | ||
{ | ||
return g(i - 1); | ||
} | ||
return 13; | ||
} | ||
|
||
int h(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 2; | ||
} | ||
if (i > 0) | ||
{ | ||
return g(i - 1); | ||
} | ||
return 12; | ||
} | ||
|
||
int procedure(int num_iterat) | ||
{ | ||
int res1 = f(num_iterat); | ||
int res2 = g(num_iterat); | ||
int res3 = h(num_iterat); | ||
int res4 = h(num_iterat); | ||
return res1 + res2 + res3 + res4; | ||
} | ||
|
||
void *t_sens(void *arg) | ||
{ | ||
// main -> t_sens -> procedure -> f(0) | ||
// main -> t_sens -> procedure -> g(0) | ||
// main -> t_sens -> procedure -> h(0) | ||
__goblint_check(procedure(0) == 8); | ||
return NULL; | ||
} | ||
|
||
void *t_sens2(void *arg) | ||
{ | ||
// main -> t_sens2 -> procedure -> f(3) -> ... -> f(0) | ||
// [main, t_sens2, procedure, f] and [main, t_sens2, procedure] {f} (3 times) | ||
// main -> t_sens2 -> procedure -> g(3) -> ... -> g(0) | ||
// [main, t_sens2, procedure, g] and [main, t_sens2, procedure] {g} (3 times) | ||
// main -> t_sens2 -> procedure -> h(3) -> g(2) -> ... -> g(0) | ||
// [main, t_sens2, procedure, h, g] and [main, t_sens2, procedure, h] {g} (2 times) | ||
__goblint_check(procedure(3) == 10); | ||
return NULL; | ||
} | ||
|
||
int main() | ||
{ | ||
pthread_t id; | ||
pthread_t id2; | ||
|
||
// Create the thread | ||
pthread_create(&id, NULL, t_sens, NULL); | ||
pthread_create(&id2, NULL, t_sens2, NULL); | ||
return 0; | ||
} |
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,71 @@ | ||
// PARAM: --set "ana.activated[+]" loopfree_callstring --enable ana.int.interval_set | ||
#include <pthread.h> | ||
#include <stdio.h> | ||
#include <goblint.h> | ||
|
||
int f(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 1; | ||
} | ||
if (i > 0) | ||
{ | ||
return f(i - 1); | ||
} | ||
return 11; | ||
} | ||
|
||
int g(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 3; | ||
} | ||
if (i > 0) | ||
{ | ||
return g(i - 1); | ||
} | ||
return 13; | ||
} | ||
|
||
int h(int i) | ||
{ | ||
if (i == 0) | ||
{ | ||
return 2; | ||
} | ||
if (i > 0) | ||
{ | ||
return g(i - 1); | ||
} | ||
return 12; | ||
} | ||
|
||
int procedure(int num_iterat) | ||
{ | ||
int res1 = f(num_iterat); | ||
int res2 = g(num_iterat); | ||
int res3 = h(num_iterat); | ||
int res4 = h(num_iterat); | ||
return res1 + res2 + res3 + res4; | ||
} | ||
|
||
void *t_ins(void *arg) | ||
{ | ||
// main -> t_ins -> procedure -> f(12) -> ... -> f(0) | ||
// [main, t_ins, procedure, f] and [main, t_ins, procedure] {f} (12 times) | ||
// main -> t_ins -> procedure -> g(12) -> g(11) -> ... -> g(0) | ||
// main -> t_ins -> procedure -> h(12) -> g(11) -> ... -> g(0) | ||
__goblint_check(procedure(12) == 10); // UNKNOWN | ||
return NULL; | ||
} | ||
|
||
int main() | ||
{ | ||
pthread_t id; | ||
|
||
// Create the thread | ||
pthread_create(&id, NULL, t_ins, NULL); | ||
return 0; | ||
} |
Oops, something went wrong.