gcc/testsuite/g++.dg/opt/pr19317-3.C
raw| 1 | // PR c++/19317 |
| 2 | // { dg-options "-O2" } |
| 3 | // { dg-do run } |
| 4 | |
| 5 | extern "C" void abort (void); |
| 6 | |
| 7 | struct A { int c; int d; int e; int f; }; |
| 8 | |
| 9 | A |
| 10 | foo (const A *x, const A *r) |
| 11 | { |
| 12 | A t; |
| 13 | t.c = -1; |
| 14 | t.c += x->c < r->c ? x->c : r->c; |
| 15 | t.d = 0; |
| 16 | t.e = 0; |
| 17 | t.f = 0; |
| 18 | return t; |
| 19 | } |
| 20 | |
| 21 | int |
| 22 | main () |
| 23 | { |
| 24 | A a; |
| 25 | a.c = 10; |
| 26 | a.d = 0; |
| 27 | a.e = 0; |
| 28 | a.f = 0; |
| 29 | A b; |
| 30 | b.c = 100; |
| 31 | b.d = 0; |
| 32 | b.e = 0; |
| 33 | b.f = 0; |
| 34 | a = foo (&b, &a); |
| 35 | if (a.c != 9) |
| 36 | abort (); |
| 37 | } |