re PR middle-end/17526 (libcpp is miscompiled with -fno-pcc-struct-return -O2)
authorRichard Guenther <rguenther@suse.de>
Sun, 25 May 2008 17:16:38 +0000 (17:16 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 25 May 2008 17:16:38 +0000 (17:16 +0000)
2008-05-25  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/17526
* gcc.dg/torture/pr17526.c: New testcase.

From-SVN: r135876

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr17526.c [new file with mode: 0644]

index 951fe3d5c8a8d989089021a39b5e431eaa08b5d0..27e51f85db211361fc144da8f08e370c920469cc 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-25  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/17526
+       * gcc.dg/torture/pr17526.c: New testcase.
+
 2008-05-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.dg/tg-tests.h: Fix spelling of FP_INFINITE.
diff --git a/gcc/testsuite/gcc.dg/torture/pr17526.c b/gcc/testsuite/gcc.dg/torture/pr17526.c
new file mode 100644 (file)
index 0000000..58b4791
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-fno-pcc-struct-return" { target i?86-*-* } } */
+
+void abort(void);
+
+typedef struct { int i; } A;
+
+A __attribute__((noinline))
+foo(void)
+{
+    A a = { -1 };
+    return a;
+}
+
+void __attribute__((noinline))
+bar(A *p)
+{
+    *p = foo();
+}
+
+int main(void)
+{
+    A a;
+    bar(&a);
+    if (a.i != -1) abort();
+    return 0;
+}