From: Richard Guenther Date: Sun, 25 May 2008 17:16:38 +0000 (+0000) Subject: re PR middle-end/17526 (libcpp is miscompiled with -fno-pcc-struct-return -O2) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fb238648c42ed68efbf890c01cb9631a02455a2a;p=gcc.git re PR middle-end/17526 (libcpp is miscompiled with -fno-pcc-struct-return -O2) 2008-05-25 Richard Guenther PR tree-optimization/17526 * gcc.dg/torture/pr17526.c: New testcase. From-SVN: r135876 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 951fe3d5c8a..27e51f85db2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-25 Richard Guenther + + PR tree-optimization/17526 + * gcc.dg/torture/pr17526.c: New testcase. + 2008-05-24 Kaveh R. Ghazi * 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 index 00000000000..58b479143a8 --- /dev/null +++ b/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; +}