aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr17526.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/torture/pr17526.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/torture/pr17526.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr17526.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr17526.c
new file mode 100644
index 000000000..58b479143
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr17526.c
@@ -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;
+}