summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/20100906-1.c
blob: a6541e3ff8432979fe3cf9d254653b49c525ba2b (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
42
43
44
45
46
47
48
/* { dg-do run } */
/* { dg-options "-O2" } */

/* This testcase got misoptimized by combine due to a wrong setting of
   subst_low_luid in try_combine.  */

enum rtx_code {
  A, B
};

void abort (void);

struct rtx_def {
  __extension__ enum rtx_code code:16;
};
typedef struct rtx_def *rtx;

void __attribute__((noinline))
add_constraint (unsigned char is_a)
{
  if (is_a)
    abort ();
}

void __attribute__((noinline))
foo (rtx defn)
{
  switch (defn->code)
    {
    case A:
    case B:
      add_constraint (defn->code == A);
      break;
    default:
      break;
    }
}

int
main ()
{
  struct rtx_def r;

  r.code = B;

  foo (&r);
  return 0;
}