https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112282
avieira at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |avieira at gcc dot gnu.org --- Comment #9 from avieira at gcc dot gnu.org --- So I had a look at this and this is as far as I got. It seems to get stuck in the 'for (u = -22; u < 2; ++u)' loop. It looks like the loop IV never gets updated and it keeps looping. Looking at the codegen it seems that cunroll decides to remove A LOT of code and there is now: bb 4: .. # ivtmp_1055 = PHI <ivtmp_1056(24), 24(2)> .. bb 24: ... ivtmp_1056 = ivtmp_1055 - 1; goto <bb 4>; [100.00%] I've not yet been able to figure out why this happens, the dumps weren't very helpful. So I tried -fdisable-tree-cunroll, it was still failing. So I looked at the dumps to try and see what was turning this loop into an infinite loop and vrp2 shows me: Global Exported: _19 = [irange] int [-21, 0] Folding predicate _19 != 2 to 1 and in the dump before vrp2 we see: <bb 4> [local count: 7354175]: # u.13_485 = PHI <_19(105), -22(3)> # u_lsm.72_510 = PHI <_19(105), _497(D)(3)> # u_lsm_flag.73_235 = PHI <1(105), 0(3)> ... <bb 27> [local count: 6634488]: al ={v} {CLOBBER(eol)}; _19 = u.13_485 + 1; if (_19 != 2) goto <bb 105>; [96.34%] else goto <bb 28>; [3.66%] <bb 105> [local count: 6391666]: goto <bb 4>; [100.00%] Something to point out here, that u_lsm.72_510 seems odd. It is used to set global 'u', but its initialized with _497(D) which is undefined... So that itself seems wrong to me too... I'll try and find out what's causing that codegen next. Maybe that can explain why the irange for _19 is so wrong here.