mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-12 07:39:30 +08:00
* gcc.c-torture/execute/20041112-1.c: New test.
From-SVN: r90522
This commit is contained in:
parent
f58c00e3f1
commit
805221b926
@ -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.
|
||||
|
40
gcc/testsuite/gcc.c-torture/execute/20041112-1.c
Normal file
40
gcc/testsuite/gcc.c-torture/execute/20041112-1.c
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user