aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr20017.c
blob: 47c048fdc62e905e95b32ab9161f3860da3d9362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* PR rtl-optimization/20017

   After CSE/GCSE folds a switch statement to an unconditional jump,
   cfg_cleanup did not remove a dead jump table, confusing the CFG
   layout code later on.  */

/* { dg-do compile } */
/* { dg-options "-O1" } */
/* { dg-options "-O1 -march=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */

int
foo (int *buf, int *p)
{
  int result;
  const int *tmp;

  if (*buf)
    return 1;

  result = 2;
  *buf = 2;
  tmp = buf;
  switch (*tmp)
    {
    case 3:
    case 4:
    case 6:
    case 14:
      return 1;

    case 0:
      result = *p;

      /* Fall through.  */
    default:
      if (result)
	return 1;
    }

  return 0;
}