-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invalidate variables (potentially) modified by an asm statement
- Loading branch information
Showing
23 changed files
with
437 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <assert.h> | ||
|
||
int main() | ||
{ | ||
int x; | ||
|
||
asm("nop"); | ||
|
||
asm volatile(""); | ||
|
||
assert(1); | ||
|
||
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,12 @@ | ||
#include <assert.h> | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
|
||
asm("nop"); | ||
|
||
assert(x == 0); | ||
|
||
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,12 @@ | ||
#include <assert.h> | ||
|
||
int x = 0; | ||
|
||
int main() | ||
{ | ||
asm("nop"); | ||
|
||
assert(x == 0); // UNKNOWN | ||
|
||
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,12 @@ | ||
#include <assert.h> | ||
|
||
int x = 0; | ||
|
||
int main() | ||
{ | ||
asm("movl $1, x" : : : "memory"); | ||
|
||
assert(x == 1); // UNKNOWN | ||
|
||
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,15 @@ | ||
#include <assert.h> | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y = 0; | ||
|
||
asm("nop" | ||
: "=r"(x)); | ||
|
||
assert(x == 0); // UNKNOWN | ||
assert(y == 0); | ||
|
||
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,15 @@ | ||
#include <assert.h> | ||
|
||
int x = 0; | ||
int y = 0; | ||
|
||
int main() | ||
{ | ||
asm("nop" | ||
: "=r"(x)); | ||
|
||
assert(x == 0); // UNKNOWN | ||
assert(y == 0); | ||
|
||
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,20 @@ | ||
#include <assert.h> | ||
|
||
int gx = 0; | ||
int gy = 0; | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y = 0; | ||
|
||
asm("nop" | ||
: "=r"(x), "=r"(gx)); | ||
|
||
assert(x == 0); // UNKNOWN | ||
assert(y == 0); | ||
assert(gx == 0); // UNKNOWN | ||
assert(gy == 0); | ||
|
||
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,17 @@ | ||
#include <assert.h> | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y = 0; | ||
int z = 0; | ||
|
||
asm("nop" | ||
: "=r"(x), "=r"(y)); | ||
|
||
assert(x == 0); // UNKNOWN | ||
assert(y == 0); // UNKNOWN | ||
assert(z == 0); | ||
|
||
return 0; | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/regression/56-asm/14-advanced-discard-global-multi.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,17 @@ | ||
#include <assert.h> | ||
|
||
int x = 0; | ||
int y = 0; | ||
int z = 0; | ||
|
||
int main() | ||
{ | ||
asm("nop" | ||
: "=r"(x), "=r"(y)); | ||
|
||
assert(x == 0); // UNKNOWN | ||
assert(y == 0); // UNKNOWN | ||
assert(z == 0); | ||
|
||
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,24 @@ | ||
#include <assert.h> | ||
|
||
int gx = 0; | ||
int gy = 0; | ||
int gz = 0; | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y = 0; | ||
int z = 0; | ||
|
||
asm("nop" | ||
: "=r"(x), "=r"(y), "=r"(gx), "=r"(gy)); | ||
|
||
assert(x == 0); // UNKNOWN | ||
assert(y == 0); // UNKNOWN | ||
assert(z == 0); | ||
assert(gx == 0); // UNKNOWN | ||
assert(gy == 0); // UNKNOWN | ||
assert(gz == 0); | ||
|
||
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,16 @@ | ||
#include <assert.h> | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y = 0; | ||
|
||
asm("nop" | ||
: | ||
: "r"(x)); | ||
|
||
assert(x == 0); | ||
assert(y == 0); | ||
|
||
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,16 @@ | ||
#include <assert.h> | ||
|
||
int x = 0; | ||
int y = 0; | ||
|
||
int main() | ||
{ | ||
asm("nop" | ||
: | ||
: "r"(x)); | ||
|
||
assert(x == 0); | ||
assert(y == 0); | ||
|
||
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,21 @@ | ||
#include <assert.h> | ||
|
||
int gx = 0; | ||
int gy = 0; | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y = 0; | ||
|
||
asm("nop" | ||
: | ||
: "r"(x), "r"(gx)); | ||
|
||
assert(x == 0); | ||
assert(y == 0); | ||
assert(gx == 0); | ||
assert(gy == 0); | ||
|
||
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,18 @@ | ||
#include <assert.h> | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y = 0; | ||
int z = 0; | ||
|
||
asm("nop" | ||
: | ||
: "r"(x), "r"(y)); | ||
|
||
assert(x == 0); | ||
assert(y == 0); | ||
assert(z == 0); | ||
|
||
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,18 @@ | ||
#include <assert.h> | ||
|
||
int x = 0; | ||
int y = 0; | ||
int z = 0; | ||
|
||
int main() | ||
{ | ||
asm("nop" | ||
: | ||
: "r"(x), "r"(y)); | ||
|
||
assert(x == 0); | ||
assert(y == 0); | ||
assert(z == 0); | ||
|
||
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,25 @@ | ||
#include <assert.h> | ||
|
||
int gx = 0; | ||
int gy = 0; | ||
int gz = 0; | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y = 0; | ||
int z = 0; | ||
|
||
asm("nop" | ||
: | ||
: "r"(x), "r"(y), "r"(gx), "r"(gy)); | ||
|
||
assert(x == 0); | ||
assert(y == 0); | ||
assert(z == 0); | ||
assert(gx == 0); | ||
assert(gy == 0); | ||
assert(gz == 0); | ||
|
||
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,17 @@ | ||
#include <assert.h> | ||
|
||
int main() | ||
{ | ||
int x = 0; | ||
int y; | ||
|
||
if (!y) | ||
{ | ||
asm("movl $1, %0" | ||
: "=r"(x)); | ||
} | ||
|
||
assert(x == 1); // UNKNOWN | ||
|
||
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,19 @@ | ||
#include <assert.h> | ||
|
||
int main() | ||
{ | ||
struct test | ||
{ | ||
int a; | ||
int b; | ||
} x = {0, 0}; | ||
int y; | ||
|
||
asm("movl $1, %0" | ||
: "=r"(x.a)); | ||
|
||
assert(x.a == 1); // UNKNOWN | ||
assert(x.b == 0); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.