gcc/testsuite/c-c++-common/Wswitch-unreachable-3.c
raw| 1 | /* { dg-do compile } */ |
| 2 | |
| 3 | extern void f (int *); |
| 4 | |
| 5 | void |
| 6 | g (int i) |
| 7 | { |
| 8 | switch (i) |
| 9 | { |
| 10 | int a[3]; |
| 11 | __builtin_memset (a, 0, sizeof a); /* { dg-warning "statement will never be executed" } */ |
| 12 | |
| 13 | default: |
| 14 | f (a); |
| 15 | } |
| 16 | |
| 17 | switch (i) |
| 18 | { |
| 19 | int a[3]; |
| 20 | int b[3]; |
| 21 | int c[3]; |
| 22 | b[1] = 60; /* { dg-warning "statement will never be executed" } */ |
| 23 | |
| 24 | default: |
| 25 | f (a); |
| 26 | f (b); |
| 27 | f (c); |
| 28 | } |
| 29 | } |