diff options
author | Eric Botcazou <ebotcazou@act-europe.fr> | 2004-11-12 10:03:03 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2004-11-12 09:03:03 +0000 |
commit | 805221b9265c751508113a25af236d9f3429b46d (patch) | |
tree | 5ed3918c7b8d0ede36fa5b61ee5b694562607438 | |
parent | f58c00e3f13c47b48a85ad58a40374542098264c (diff) | |
download | gcc-805221b9265c751508113a25af236d9f3429b46d.zip gcc-805221b9265c751508113a25af236d9f3429b46d.tar.gz gcc-805221b9265c751508113a25af236d9f3429b46d.tar.bz2 |
* gcc.c-torture/execute/20041112-1.c: New test.
From-SVN: r90522
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20041112-1.c | 40 |
2 files changed, 44 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8742135..f04c8ab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-11-12 Eric Botcazou <ebotcazou@act-europe.fr> + + * gcc.c-torture/execute/20041112-1.c: New test. + 2004-11-11 Janis Johnson <janis187@us.ibm.com> * lib/gcc-dg.exp (dg-target-list): New. diff --git a/gcc/testsuite/gcc.c-torture/execute/20041112-1.c b/gcc/testsuite/gcc.c-torture/execute/20041112-1.c new file mode 100644 index 0000000..0c6251c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20041112-1.c @@ -0,0 +1,40 @@ +/* This was failing on Alpha because the comparison (p != -1) was rewritten + as (p+1 != 0) and p+1 isn't allowed to wrap for pointers. */ + +extern void abort(void); + +typedef __SIZE_TYPE__ size_t; + +int global; + +static void *foo(int p) +{ + if (p == 0) + { + global++; + return &global; + } + + return (void *)(size_t)-1; +} + +int bar(void) +{ + void *p; + + p = foo(global); + if (p != (void *)(size_t)-1) + return 1; + + global++; + return 0; +} + +int main(void) +{ + global = 1; + if (bar () != 0) + abort(); + + return 0; +} |