PR middle-end/77674
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr38572.C
blob89d228f02d0d014960fbe18db362086ec6104081
1 // PR tree-optimization/38572
2 // { dg-do compile }
3 // { dg-options "-O2" }
5 // Crash caused by the out-of-bounds enum values (all the remaining cruft
6 // is needed only to trigger the appropriate code path in tree-vrp.c).
7 enum JSOp
9   JSOP_GETELEM = 5,
10   JSOP_LIMIT
12 extern void g ();
13 void f (char *pc, char *endpc, int format, char ***fp, enum JSOp op)
15   while (pc <= endpc)
16     {
17       if ((fp && *fp && pc == **fp) || pc == endpc)
18         {
19           if (format == 1)
20             op = (JSOp) 256;
21           else if (format == 2)
22             op = (JSOp) 257;
23           else
24             op = JSOP_GETELEM;
25         }
26       if (op >= JSOP_LIMIT)
27         {
28           if (format)
29             g ();
30         }
31     }