gcc/testsuite/c-c++-common/Wduplicated-branches-3.c
raw| 1 | /* PR c/64279 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-Wduplicated-branches" } */ |
| 4 | |
| 5 | extern int *g; |
| 6 | |
| 7 | void |
| 8 | f (short int i) |
| 9 | { |
| 10 | if (i == 0) /* { dg-warning "this condition has identical branches" } */ |
| 11 | *g = (int) i; |
| 12 | else |
| 13 | *g = (int) i; |
| 14 | |
| 15 | if (i == 1) |
| 16 | *g = (unsigned char) i; |
| 17 | else |
| 18 | *g = (signed char) i; |
| 19 | } |