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

            Bug ID: 122010
           Summary: Infinite recursive call not reported and silently
                    optimized away
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: [email protected]
  Target Milestone: ---

In the following simple function,

void test(int flag)
{
        if (flag)
                test(flag);
}

The x86 backend silently optimizes away the infinite recursive call if flag !=
0:

        .type   test, @function
test:
.LFB0:
        ret


Other backends (like m68k) do the right thing, but don't report any warning:


        .type   test, @function
test:
        tst.l 4(%sp)
        jne .L3
        rts
.L3:
        jra .L3

Reply via email to