| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
extern void bar (void); |
| 5 |
|
| 6 |
/* Case 181 is not in the range for 'char'. */ |
| 7 |
void |
| 8 |
foo1 (char *buf) |
| 9 |
{ |
| 10 |
int x = *buf; |
| 11 |
switch (x) |
| 12 |
{ |
| 13 |
case -76: |
| 14 |
case 65: |
| 15 |
case 181: |
| 16 |
bar(); |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
/* All cases are below the range of char. */ |
| 21 |
void |
| 22 |
foo2 (char *buf) |
| 23 |
{ |
| 24 |
int x = *buf; |
| 25 |
switch (x) |
| 26 |
{ |
| 27 |
case -150: |
| 28 |
case -140: |
| 29 |
case -130: |
| 30 |
bar(); |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
/* All cases are above the range of char. */ |
| 35 |
void |
| 36 |
foo3 (char *buf) |
| 37 |
{ |
| 38 |
int x = *buf; |
| 39 |
switch (x) |
| 40 |
{ |
| 41 |
case 130: |
| 42 |
case 140: |
| 43 |
case 150: /* This case is not in the range for 'char'. */ |
| 44 |
bar(); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
/* The bounding cases are partially out of range for char. */ |
| 49 |
void |
| 50 |
foo4 (char *buf) |
| 51 |
{ |
| 52 |
int x = *buf; |
| 53 |
switch (x) |
| 54 |
{ |
| 55 |
case -130 ... -120: |
| 56 |
case 100: |
| 57 |
case 120 ... 130: |
| 58 |
bar(); |
| 59 |
} |
| 60 |
} |
| 61 |
|