gcc/testsuite/gcc.dg/pr91195.c
raw| 1 | /* PR middle-end/91195 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-Wmaybe-uninitialized -O2" } */ |
| 4 | |
| 5 | int bar (char*); |
| 6 | |
| 7 | void |
| 8 | foo (char *x, char *y) |
| 9 | { |
| 10 | char *a[2]; |
| 11 | int b = 0; |
| 12 | |
| 13 | if (x) |
| 14 | a[b++] = x; /* { dg-bogus "may be used uninitialized in this function" } */ |
| 15 | if (y) |
| 16 | a[b++] = y; |
| 17 | |
| 18 | for (int j = 0; j < 4; j++) |
| 19 | switch (j) |
| 20 | { |
| 21 | case 0: |
| 22 | if (b == 0 || bar (a[0])) |
| 23 | break; |
| 24 | } |
| 25 | } |