OSDN Git Service

2006-06-19 Anatoly Sokolov <aesok@post.ru>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr18628.c
1 /* { dg-do link } */
2 /* { dg-options "-O2" } */
3
4 /* PR middle-end/18628 exposed a problem in which cse folded a load
5    from a jump table into the label that was the target of the branch.
6    Unfortunately, the indirect jump was moved to a different basic
7    block, and the LABEL_REF copied to the register wasn't enough to
8    keep the cfg from optimizing the otherwise-unused label away.  So
9    we ended up with a dangling reference to the label.  */
10
11 int i;
12
13 int main()
14 {
15   for (;;)
16   {
17     switch (i)
18     {
19       case 0:
20       case 1:
21         return 1;
22
23       case 2:
24       case 3:
25         return 0;
26
27       case 5:
28         --i;
29     }
30   }
31 }