1290000Sglebius/* PR rtl-optimization/20017
2290000Sglebius
3290000Sglebius   After CSE/GCSE folds a switch statement to an unconditional jump,
4106163Sroberto   cfg_cleanup did not remove a dead jump table, confusing the CFG
5290000Sglebius   layout code later on.  */
682498Sroberto
7290000Sglebius/* { dg-do compile } */
8106163Sroberto/* { dg-options "-O1" } */
9106163Sroberto/* { dg-options "-O1 -march=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
10106163Sroberto
1182498Srobertoint
1282498Srobertofoo (int *buf, int *p)
1382498Sroberto{
1482498Sroberto  int result;
1582498Sroberto  const int *tmp;
16290000Sglebius
17290000Sglebius  if (*buf)
1882498Sroberto    return 1;
19290000Sglebius
20290000Sglebius  result = 2;
21290000Sglebius  *buf = 2;
22290000Sglebius  tmp = buf;
23290000Sglebius  switch (*tmp)
24290000Sglebius    {
25290000Sglebius    case 3:
2682498Sroberto    case 4:
27106163Sroberto    case 6:
28290000Sglebius    case 14:
29106163Sroberto      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}
42