]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
This commit was manufactured by cvs2svn to create branch
authorNo Author <no-author@gcc.gnu.org>
Fri, 12 Nov 2004 09:11:38 +0000 (09:11 +0000)
committerNo Author <no-author@gcc.gnu.org>
Fri, 12 Nov 2004 09:11:38 +0000 (09:11 +0000)
'gcc-3_4-branch'.

From-SVN: r90523

gcc/testsuite/gcc.c-torture/execute/20041112-1.c [new file with mode: 0644]

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 (file)
index 0000000..0c6251c
--- /dev/null
@@ -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;
+}