-
Notifications
You must be signed in to change notification settings - Fork 84
Incremental: Reset ckeys for anonymous structs and unions #942
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1179058
Add race test case to incremental benchmarks.
jerhard e154710
Change test case for issue 678
jerhard 20d01b1
Add another test for issue 678
jerhard fec7d0e
Reset ckeys for anonymous strcuts/unions.
jerhard 07ad8f5
Remove checks for in-equality before reseting cname and ckey.
jerhard 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #include <pthread.h> | ||
|
|
||
| typedef struct foo_struct { | ||
| union { | ||
| int i; | ||
| struct inner_struct { | ||
| int head, tail; | ||
| } coin; | ||
| }; | ||
| } foo_t; | ||
|
|
||
| foo_t str; | ||
|
|
||
| void *read(void *ptr){ | ||
| int x = str.coin.head; // RACE! | ||
| int a = 32; | ||
| return NULL; | ||
| } | ||
|
|
||
| void *write(void *ptr){ | ||
| str.coin.head = 23; // RACE! | ||
| return NULL; | ||
| } | ||
|
|
||
| int main(){ | ||
| pthread_t r; | ||
| pthread_t w; | ||
|
|
||
| pthread_create(&w, NULL, write, NULL); | ||
| pthread_create(&r, NULL, read, NULL); | ||
|
|
||
| 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,2 @@ | ||
| { | ||
| } |
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,34 @@ | ||
| diff --git tests/incremental/00-basic/13-anonymous-compound.c tests/incremental/00-basic/13-anonymous-compound.c | ||
| index 3e2d7b527..81f3e704a 100644 | ||
| --- tests/incremental/00-basic/13-anonymous-compound.c | ||
| +++ tests/incremental/00-basic/13-anonymous-compound.c | ||
| @@ -1,5 +1,21 @@ | ||
| #include <pthread.h> | ||
|
|
||
| + | ||
| +typedef struct foo_bar { | ||
| + int x; | ||
| + int y; | ||
| +} foo_bar_t; | ||
| + | ||
| +typedef struct bar { | ||
| + union{ | ||
| + int x; | ||
| + struct inner { | ||
| + int a; | ||
| + int b; | ||
| + } i; | ||
| + } un; | ||
| +} bar_t; | ||
| + | ||
| typedef struct foo_struct { | ||
| union { | ||
| int i; | ||
| @@ -13,6 +29,7 @@ foo_t str; | ||
|
|
||
| void *read(void *ptr){ | ||
| int x = str.coin.head; // RACE! | ||
| + int y = str.coin.head; // RACE! | ||
| int a = 32; | ||
| return NULL; | ||
| } |
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,33 @@ | ||
| #include <pthread.h> | ||
|
|
||
| typedef struct foo_struct { | ||
| union { | ||
| int i; | ||
| struct inner_struct { | ||
| int head, tail; | ||
| } coin; | ||
| } un; | ||
| } foo_t; | ||
|
|
||
| foo_t str; | ||
|
|
||
| void *read(void *ptr){ | ||
| int x = str.un.coin.head; // RACE! | ||
| int a = 32; | ||
| return NULL; | ||
| } | ||
|
|
||
| void *write(void *ptr){ | ||
| str.un.coin.head = 23; // RACE! | ||
| return NULL; | ||
| } | ||
|
|
||
| int main(){ | ||
| pthread_t r; | ||
| pthread_t w; | ||
|
|
||
| pthread_create(&w, NULL, write, NULL); | ||
| pthread_create(&r, NULL, read, NULL); | ||
|
|
||
| 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,2 @@ | ||
| { | ||
| } |
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,23 @@ | ||
| diff --git tests/incremental/00-basic/14-struct.c tests/incremental/00-basic/14-struct.c | ||
| index 6eadc7a57..568a90aed 100644 | ||
| --- tests/incremental/00-basic/14-struct.c | ||
| +++ tests/incremental/00-basic/14-struct.c | ||
| @@ -1,5 +1,10 @@ | ||
| #include <pthread.h> | ||
|
|
||
| +typedef struct foo_bar { | ||
| + int x; | ||
| + int y; | ||
| +} foo_bar_t; | ||
| + | ||
| typedef struct foo_struct { | ||
| union { | ||
| int i; | ||
| @@ -12,6 +17,7 @@ typedef struct foo_struct { | ||
| foo_t str; | ||
|
|
||
| void *read(void *ptr){ | ||
| + int x = str.un.coin.head; // RACE! | ||
| int x = str.un.coin.head; // RACE! | ||
| int a = 32; | ||
| return NULL; |
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.