gcc/testsuite/c-c++-common/analyzer/pr94099.c
raw| 1 | /* { dg-additional-options "-O1" } */ |
| 2 | |
| 3 | struct cg { |
| 4 | int hk; |
| 5 | int *bg; |
| 6 | }; |
| 7 | |
| 8 | union vb { |
| 9 | struct cg gk; |
| 10 | }; |
| 11 | |
| 12 | void |
| 13 | l3 (union vb *); |
| 14 | |
| 15 | void |
| 16 | pl (void) |
| 17 | { |
| 18 | union vb th = { 0, }; |
| 19 | int sc; |
| 20 | |
| 21 | for (sc = 0; sc < 1; ++sc) |
| 22 | { |
| 23 | th.gk.hk = 0; |
| 24 | th.gk.bg[sc] = 0; /* { dg-warning "dereference of NULL '0'" } */ |
| 25 | // TODO: above message could be improved |
| 26 | l3 (&th); |
| 27 | } |
| 28 | } |