-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
5 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/example-archive/c-testsuite/broken/error-proof/00073.err1.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,20 @@ | ||
/* | ||
cn: internal error, uncaught exception: | ||
Failure("todo") | ||
*/ | ||
// Cause: `-=` assignment operator | ||
|
||
int | ||
main() | ||
{ | ||
int arr[2]; | ||
int *p; | ||
|
||
p = &arr[1]; | ||
p -= 1; | ||
*p = 123; | ||
|
||
if(arr[0] != 123) | ||
return 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,35 @@ | ||
// Crash: caused by pointer decrement | ||
|
||
int | ||
main() | ||
/*@ ensures return == 0i32; @*/ | ||
{ | ||
int arr[2]; | ||
int *p; | ||
|
||
/*@ extract Block<int>, 0u64; @*/ | ||
arr[0] = 2; | ||
/*@ extract Block<int>, 1u64; @*/ | ||
arr[1] = 3; | ||
p = &arr[0]; | ||
if(*(p++) != 2) | ||
return 1; | ||
if(*(p++) != 3) | ||
return 2; | ||
|
||
p = &arr[1]; | ||
if(*(p--) != 3) | ||
return 1; | ||
if(*(p--) != 2) | ||
return 2; | ||
|
||
p = &arr[0]; | ||
if(*(++p) != 3) | ||
return 1; | ||
|
||
p = &arr[1]; | ||
if(*(--p) != 2) // <-- cause of the crash | ||
return 1; | ||
|
||
return 0; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/example-archive/simple-examples/broken/error-proof/pointer_dec3.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,9 @@ | ||
// Crash | ||
|
||
void | ||
pointerdec_crash_3() | ||
{ | ||
int arr[2]; | ||
int *p = &arr[1]; | ||
*(--p); | ||
} |
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,5 @@ | ||
int a; | ||
void b() { | ||
int *c = &a; | ||
c -= 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,7 @@ | ||
// Derived from src/example-archive/c-testsuite/broken/error-proof/00032.err1.c | ||
|
||
int a; | ||
void b() { | ||
int *c = &a; | ||
--c; | ||
} |