gcc/testsuite/gcc.dg/ubsan/pr89284.c
raw| 1 | /* PR middle-end/89284 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-fsanitize=undefined -O0 -Wuninitialized" } */ |
| 4 | |
| 5 | struct A { _Bool a; int i; }; |
| 6 | |
| 7 | int |
| 8 | foo (void) |
| 9 | { |
| 10 | struct A a; |
| 11 | if (a.i) /* { dg-warning "'a.i' is used uninitialized" } */ |
| 12 | return 1; |
| 13 | return 0; |
| 14 | } |
| 15 | |
| 16 | int |
| 17 | bar (void) |
| 18 | { |
| 19 | struct A a; |
| 20 | if (a.a) /* { dg-warning "'a.a' is used uninitialized" } */ |
| 21 | return 1; |
| 22 | return 0; |
| 23 | } |