blob: 10414a2a50c07adcd6f0ae3df7b86ee2ce4a0a78 (
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
|
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
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);
}
/* The switch should be switch converted and later constant propagated. */
/* { dg-final { scan-tree-dump-not "CSWTCH" "optimized"} } */
/* { dg-final { scan-tree-dump-not "switch" "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
|