gcc/testsuite/gcc.dg/pr39343.c
raw| 1 | /* PR tree-optimization/39343 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-O2" } */ |
| 4 | |
| 5 | extern void abort (void); |
| 6 | |
| 7 | extern inline __attribute__ ((__always_inline__)) int |
| 8 | foo (char *dest) |
| 9 | { |
| 10 | return __builtin_object_size (dest, 1); |
| 11 | } |
| 12 | |
| 13 | struct S |
| 14 | { |
| 15 | union |
| 16 | { |
| 17 | struct { int a, b; char c, d; } f; |
| 18 | struct { struct { int a, b; char c, d[255]; } e; } g; |
| 19 | } u; |
| 20 | }; |
| 21 | |
| 22 | int |
| 23 | main (void) |
| 24 | { |
| 25 | struct S s; |
| 26 | if (foo (s.u.g.e.d) != 255) |
| 27 | abort (); |
| 28 | return 0; |
| 29 | } |