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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |tree-optimization
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-05-30
            Summary|Failure to optimize         |Failure to optimize
                   |infinite recursion for      |infinite recursion for
                   |struct types                |empty struct types

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The problem only exist for empty structs.  If we add a field, we get the better
code:
foo:
.LFB0:
        .cfi_startproc
        .p2align 3,,7
.L2:
        b       .L2


The reason why this happens is because we remove the assignment for empty
struct assignment during gimplification.  This messes up how tailr and tailc
works.

Note here is a testcase for tailc:
struct A {};
struct A goo(void);
struct A foo(void)
{
  return goo();
}

Reply via email to