From 805221b9265c751508113a25af236d9f3429b46d Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 12 Nov 2004 10:03:03 +0100 Subject: [PATCH] * gcc.c-torture/execute/20041112-1.c: New test. From-SVN: r90522 --- gcc/testsuite/ChangeLog | 4 ++ .../gcc.c-torture/execute/20041112-1.c | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/20041112-1.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 87421355976..f04c8abaf5a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-11-12 Eric Botcazou + + * gcc.c-torture/execute/20041112-1.c: New test. + 2004-11-11 Janis Johnson * 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 00000000000..0c6251ca34e --- /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; +} -- 2.30.2