1 // PR tree-optimization/38572 2 // { dg-do compile } 3 // { dg-options "-O2" } 4 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 8 { 9 JSOP_GETELEM = 5, 10 JSOP_LIMIT 11 }; 12 extern void g (); f(char * pc,char * endpc,int format,char *** fp,enum JSOp op)13void f (char *pc, char *endpc, int format, char ***fp, enum JSOp op) 14 { 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 } 32 } 33