[Bug tree-optimization/126925] ICE at -O3 on x86_64-linux-gnu: Segmentation fault during GIMPLE pass: ivopts

"rguenth at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126925

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org
   Last reconfirmed|                            |2026-08-18
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code,
                   |                            |missed-optimization
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  The issue is that we analyzed cand->var_after (f_44) as being
invariant:

# f_42 = PHI <f_44(21), 6(20)>
h_24 = (short int) d_15(D);
_25 = (long unsigned int) d_15(D);
_27 = (long unsigned int) h_24;
_36 = _25 + 18446744073709551612;
_21 = _36 - _27;
_22 = _27 - _36;
_7 = f_42 + _22;
f_44 = _7 + _21;

here f_44 simplifies to f_42 meaning the f_42 PHI simplifies to '6'.

But that's not expected, the IV candidate is analyzed as

 {6, +, ((long unsigned int) d_15(D) - (long unsigned int) (short int) d_15(D))
+ ((long unsigned int) (short int) d_15(D) - (long unsigned int) d_15(D)) }

which failed to simplify.

I'll fix the ICE.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.