-
Notifications
You must be signed in to change notification settings - Fork 87
Improve exp.single-threaded for analysis without threadflag and escape
#1981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sim642
wants to merge
13
commits into
master
Choose a base branch
from
no-threadflag
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
94d5e3e
Add test 00-sanity/42-no-threadflag
sim642 c540556
Add TODOs about exp.single-threaded errors
sim642 c6a696e
Add test 00-sanity/43-no-threadflag-single-threaded
sim642 f925048
Use MustBeSingleThreaded query via ThreadFlag functions
sim642 86db1cd
Use exp.single-threaded for ThreadFlag queries
sim642 3b780e5
Add test 00-sanity/44-no-threadflag-single-threaded-earlyglobs
sim642 a68a47b
Combine 00-sanity/*-no-threadflag* tests into one cram test
sim642 08fbbc2
Add test 00-sanity/43-no-escape
sim642 6ea1af6
Use exp.single-threaded for ThreadEscape queries
sim642 7b2a223
Use MayEscape query via ThreadEscape.has_escaped
sim642 309026d
Promote vars count decrease in weak-deps test
sim642 354f523
Add cram test for 02-base/32-single-thr
sim642 bb1e7aa
Fix exp.single-threaded spawning errors
sim642 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,11 @@ | ||
| // CRAM | ||
| #include <goblint.h> | ||
|
|
||
| int g; | ||
|
|
||
| int main() { | ||
| __goblint_check(g == 0); | ||
| g = 1; | ||
| __goblint_check(g == 1); | ||
| return 0; | ||
| } |
This file contains hidden or 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,48 @@ | ||
| Analysis of single-threaded program with threadflag deactivated. | ||
| Also no threadid which can tell being single-threaded. | ||
|
|
||
|
|
||
| With earlyglobs disabled: no threadflag means the same behavior. | ||
| Assertions should be unknown, race should be present. | ||
|
|
||
| $ goblint --set ana.activated[-] threadflag --set ana.activated[-] threadid --disable exp.earlyglobs 42-no-threadflag.c | ||
| [Warning][Assert] Assertion "g == 0" is unknown. (42-no-threadflag.c:7:3-7:26) | ||
| [Warning][Assert] Assertion "g == 1" is unknown. (42-no-threadflag.c:9:3-9:26) | ||
| [Info][Deadcode] Logical lines of code (LLoC) summary: | ||
| live: 5 | ||
| dead: 0 | ||
| total lines: 5 | ||
| [Warning][Race] Memory location g (race with conf. 110): (42-no-threadflag.c:4:5-4:6) | ||
| write with mhp:{created={Unknown thread id}} (conf. 110) (exp: & g) (42-no-threadflag.c:8:3-8:8) | ||
| read with mhp:{created={Unknown thread id}} (conf. 110) (exp: & g) (42-no-threadflag.c:7:3-7:26) | ||
| read with mhp:{created={Unknown thread id}} (conf. 110) (exp: & g) (42-no-threadflag.c:9:3-9:26) | ||
| [Info][Race] Memory locations race summary: | ||
| safe: 0 | ||
| vulnerable: 0 | ||
| unsafe: 1 | ||
| total memory locations: 1 | ||
|
|
||
|
|
||
| With single-threaded mode forced. | ||
| Assertions should succeed, race should not be present. | ||
|
|
||
| $ goblint --set ana.activated[-] threadflag --set ana.activated[-] threadid --disable exp.earlyglobs --enable exp.single-threaded 42-no-threadflag.c | ||
| [Success][Assert] Assertion "g == 0" will succeed (42-no-threadflag.c:7:3-7:26) | ||
| [Success][Assert] Assertion "g == 1" will succeed (42-no-threadflag.c:9:3-9:26) | ||
| [Info][Deadcode] Logical lines of code (LLoC) summary: | ||
| live: 5 | ||
| dead: 0 | ||
| total lines: 5 | ||
|
|
||
|
|
||
| With single-threaded mode forced, but earlyglobs enabled. | ||
| Assertions should be unknown, race should not be present. | ||
|
|
||
| $ goblint --set ana.activated[-] threadflag --set ana.activated[-] threadid --enable exp.earlyglobs --enable exp.single-threaded 42-no-threadflag.c | ||
| [Warning][Assert] Assertion "g == 0" is unknown. (42-no-threadflag.c:7:3-7:26) | ||
| [Warning][Assert] Assertion "g == 1" is unknown. (42-no-threadflag.c:9:3-9:26) | ||
| [Info][Deadcode] Logical lines of code (LLoC) summary: | ||
| live: 5 | ||
| dead: 0 | ||
| total lines: 5 | ||
|
|
||
This file contains hidden or 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,13 @@ | ||
| // CRAM | ||
| #include <goblint.h> | ||
|
|
||
|
|
||
| int main() { | ||
| int x = 0; | ||
| __goblint_check(x == 0); | ||
| x = 1; | ||
| __goblint_check(x == 1); | ||
|
|
||
| int *p = &x; // confuse naive escape check | ||
| return 0; | ||
| } |
This file contains hidden or 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 @@ | ||
| Analysis of single-threaded program with escape deactivated. | ||
| Also earlyglobs enabled, otherwise MayEscape queries are not used. | ||
| Earlyglobs should not matter for local variable. | ||
|
|
||
|
|
||
| Assertions should be unknown. | ||
|
|
||
| $ goblint --set ana.activated[-] escape --enable exp.earlyglobs 43-no-escape.c | ||
| [Warning] Without thread escape analysis, every local variable whose address is taken is considered escaped, i.e., global! | ||
| [Warning][Assert] Assertion "x == 0" is unknown. (43-no-escape.c:7:3-7:26) | ||
| [Warning][Assert] Assertion "x == 1" is unknown. (43-no-escape.c:9:3-9:26) | ||
| [Info][Deadcode] Logical lines of code (LLoC) summary: | ||
| live: 7 | ||
| dead: 0 | ||
| total lines: 7 | ||
|
|
||
|
|
||
| With single-threaded mode forced. | ||
| Assertions should succeed. | ||
|
|
||
| $ goblint --set ana.activated[-] escape --enable exp.earlyglobs --enable exp.single-threaded 43-no-escape.c | ||
| [Warning] Without thread escape analysis, every local variable whose address is taken is considered escaped, i.e., global! | ||
| [Success][Assert] Assertion "x == 0" will succeed (43-no-escape.c:7:3-7:26) | ||
| [Success][Assert] Assertion "x == 1" will succeed (43-no-escape.c:9:3-9:26) | ||
| [Info][Deadcode] Logical lines of code (LLoC) summary: | ||
| live: 7 | ||
| dead: 0 | ||
| total lines: 7 | ||
|
|
This file contains hidden or 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,12 @@ | ||
| $ goblint --set exp.single-threaded true 32-single-thr.c | ||
| [Error][Imprecise][Unsound] Function definition missing for no_spawn (32-single-thr.c:12:3-12:15) | ||
| [Info][Imprecise] INVALIDATING ALL GLOBALS! (32-single-thr.c:12:3-12:15) | ||
| [Info][Imprecise] Invalidating expressions: & g, (void *)(& f) (32-single-thr.c:12:3-12:15) | ||
| [Error][Unsound] Thread not spawned from f (32-single-thr.c:12:3-12:15) | ||
| [Warning][Deadcode] Function 'f' is uncalled: 2 LLoC (32-single-thr.c:6:1-8:1) | ||
| [Info][Deadcode] Logical lines of code (LLoC) summary: | ||
| live: 4 | ||
| dead: 2 (2 in uncalled functions) | ||
| total lines: 6 | ||
| [Error][Unsound] Thread not spawned | ||
| [Error][Imprecise][Unsound] Function definition missing |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| $ goblint --set solver td3 --set solvers.td3.weak-deps none -v weak-deps.c 2>&1 | grep 'evals' | ||
| [Info] vars = 40 evals = 33 narrow_reuses = 0 | ||
| [Info] vars = 34 evals = 33 narrow_reuses = 0 | ||
|
|
||
| $ goblint --set solver td3 --set solvers.td3.weak-deps eager -v weak-deps.c 2>&1 | grep 'evals' | ||
| [Info] vars = 40 evals = 36 narrow_reuses = 0 | ||
| [Info] vars = 34 evals = 36 narrow_reuses = 0 | ||
|
|
||
| $ goblint --set solver td3 --set solvers.td3.weak-deps lazy -v weak-deps.c 2>&1 | grep 'evals' | ||
| [Info] vars = 40 evals = 32 narrow_reuses = 0 | ||
| [Info] vars = 34 evals = 32 narrow_reuses = 0 | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.