[Bug c++/110845] Function call when it should inline?
xry111 at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jul 29 07:32:22 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110845
Xi Ruoyao <xry111 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xry111 at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to KL from comment #2)
> Changed main to foo:
> same behavior
It's because you don't have a return statement in foo, causing an undefined
behavior. And GCC considers undefined behaviors highly improbable to be
executed, so the same logic (not to inline too much into "cold" code paths)
still applies.
If you add the return statement they are inlined:
https://godbolt.org/z/Ko9r4fn3d
More information about the Gcc-bugs
mailing list