http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54136
Bug #: 54136 Summary: Compiling phoronix/dcraw with gcc 4.8 trunk causes infinite execution. Classification: Unclassified Product: gcc Version: tree-ssa Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: venkataramanan.ku...@amd.com Attached test case is a extracted from dcraw application. GCC option used -O2 or -O1 -ftree-vrp. Target: x86_64-unknown-linux-gnu. With gcc 4.7 the test case completes. But for gcc4.8 trunk revision r189951 it results in infinite loop execution. (-----Snip-----) for (i=0; i < sizeof table / sizeof *table; i++) if (!strncmp (name, table[i].prefix, strlen(table[i].prefix))) { if (table[i].black) black = (unsigned short) table[i].black; if (table[i].maximum) maximum = (unsigned short) table[i].maximum; for (j=0; j < 12; j++) cam_xyz[0][j] = table[i].trans[j] / 10000.0; printf("reached here exiting out of loop : pointer to array cam_xyz %x\n", cam_xyz); break; } (-----Snip-----) ----test.c.067t.mergephi2----- D.2580_12 = table[i_1].maximum; if (D.2580_12 != 0) goto <bb 7>; else goto <bb 10>; <bb 7>: D.2583_13 = (short unsigned int) D.2580_12; maximum.1_14 = (unsigned int) D.2583_13; maximum = maximum.1_14; goto <bb 10>; <bb 9>: D.2585_16 = table[i_1].trans[j_2]; D.2586_17 = (double) D.2585_16; D.2587_18 = D.2586_17 / 1.0e+4; cam_xyz[0][j_2] = D.2587_18; j_19 = j_2 + 1; <bb 10>: # j_2 = PHI <0(6), j_19(9), 0(7)> if (j_2 <= 11) goto <bb 9>; else goto <bb 11>; <bb 11>: printf ("reached here exiting out of loop : pointer to array cam_xyz %x\n", &cam_xyz); goto <bb 14> After VRP ------test.c.068t.vrp1----- D.2580_12 = table[i_33].maximum; if (D.2580_12 != 0) goto <bb 7>; else goto <bb 8>; <bb 7>: D.2583_13 = (short unsigned int) D.2580_12; maximum.1_14 = (unsigned int) D.2583_13; maximum = maximum.1_14; <bb 8>: j_15 = 0; <bb 9>: # j_2 = PHI <0(8), j_19(9)> D.2585_16 = table[i_33].trans[j_2]; D.2586_17 = (double) D.2585_16; D.2587_18 = D.2586_17 / 1.0e+4; cam_xyz[0][j_2] = D.2587_18; j_19 = j_2 + 1; goto <bb 9>; <== infinite loop is formed <bb 10>: i_20 = i_1 + 1;