[Bug tree-optimization/122010] [13 Regression] Infinite recursive call not reported and silently optimized away

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Sep 21 19:24:27 GMT 2025


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122010

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is expected.

-fno-tree-ch -O2 on the trunk can reproduce the "failure".


Since without optimization, this will run out of stack space, the loop is
considered now finite. Since the loop is finite and empty, it can be removed.
That is what is happening.  r14-2709-g65ff4a45b11b5a changed the behavior
slightly in one case when it comes to recusive call loops, it copies the header
and then you have `a: goto a;` .

Anyways the missing warning well that is a different story.

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is expected.

-fno-tree-ch -O2 on the trunk can reproduce the "failure".


Since without optimization, this will run out of stack space, the loop is
considered now finite. Since the loop is finite and empty, it can be removed.
That is what is happening.  r14-2709-g65ff4a45b11b5a changed the behavior
slightly in one case when it comes to recusive call loops, it copies the header
and then you have `a: goto a;` .

Anyways the missing warning well that is a different story.


More information about the Gcc-bugs mailing list