aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr20583.c
blob: 6c5f891d3d0ed8c1332ecafb4cb01560d1795c55 (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
/* PR target/20583
   On m68k-none-elf, CSE used to generate

     (set (reg:HI ...)
          (const:HI (truncate:HI (minus:SI (label_ref ...)
                                           (label_ref ...)))))

   which output functions do not know how to handle.  Make sure that
   such a constant will be rejected.  */

void bar (unsigned int);

void
foo (void)
{
  char buf[1] = { 3 };
  const char *p = buf;
  const char **q = &p;
  unsigned int ch;
  switch (**q)
    {
    case 1:  ch = 5; break;
    case 2:  ch = 4; break;
    case 3:  ch = 3; break;
    case 4:  ch = 2; break;
    case 5:  ch = 1; break;
    default: ch = 0; break;
    }
  bar (ch);
}