| 1 |
/* PR rtl-optimization/20017 |
| 2 |
|
| 3 |
After CSE/GCSE folds a switch statement to an unconditional jump, |
| 4 |
cfg_cleanup did not remove a dead jump table, confusing the CFG |
| 5 |
layout code later on. */ |
| 6 |
|
| 7 |
/* { dg-do compile } */ |
| 8 |
/* { dg-options "-O1" } */ |
| 9 |
/* { dg-options "-O1 -march=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ |
| 10 |
|
| 11 |
int |
| 12 |
foo (int *buf, int *p) |
| 13 |
{ |
| 14 |
int result; |
| 15 |
const int *tmp; |
| 16 |
|
| 17 |
if (*buf) |
| 18 |
return 1; |
| 19 |
|
| 20 |
result = 2; |
| 21 |
*buf = 2; |
| 22 |
tmp = buf; |
| 23 |
switch (*tmp) |
| 24 |
{ |
| 25 |
case 3: |
| 26 |
case 4: |
| 27 |
case 6: |
| 28 |
case 14: |
| 29 |
return 1; |
| 30 |
|
| 31 |
case 0: |
| 32 |
result = *p; |
| 33 |
|
| 34 |
/* Fall through. */ |
| 35 |
default: |
| 36 |
if (result) |
| 37 |
return 1; |
| 38 |
} |
| 39 |
|
| 40 |
return 0; |
| 41 |
} |