gcc/testsuite/gcc.dg/torture/pr17526.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-fno-pcc-struct-return" { target i?86-*-* x86_64-*-* } } */ |
| 3 | |
| 4 | void abort(void); |
| 5 | |
| 6 | typedef struct { int i; } A; |
| 7 | |
| 8 | A __attribute__((noinline)) |
| 9 | foo(void) |
| 10 | { |
| 11 | A a = { -1 }; |
| 12 | return a; |
| 13 | } |
| 14 | |
| 15 | void __attribute__((noinline)) |
| 16 | bar(A *p) |
| 17 | { |
| 18 | *p = foo(); |
| 19 | } |
| 20 | |
| 21 | int main(void) |
| 22 | { |
| 23 | A a; |
| 24 | bar(&a); |
| 25 | if (a.i != -1) abort(); |
| 26 | return 0; |
| 27 | } |