gcc/testsuite/g++.dg/warn/uninit-1.C
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O2 -Wmaybe-uninitialized" } */ |
| 3 | struct a {int a;}; |
| 4 | __attribute__ ((noinline)) |
| 5 | void |
| 6 | nowarn (const struct a *ptr) |
| 7 | { |
| 8 | if (ptr) |
| 9 | asm volatile (""); |
| 10 | } |
| 11 | void |
| 12 | test() |
| 13 | { |
| 14 | struct a ptr; |
| 15 | nowarn (&ptr); |
| 16 | } |
| 17 | __attribute__ ((noinline)) |
| 18 | int |
| 19 | nowarn2 (const struct a *ptr, const struct a ptr2) |
| 20 | { |
| 21 | return ptr != 0 || ptr2.a; |
| 22 | } |
| 23 | int mem; |
| 24 | int |
| 25 | test2() |
| 26 | { |
| 27 | struct a ptr,ptr2={0}; |
| 28 | return nowarn2 (&ptr, ptr2); |
| 29 | } |