[Bug c++/115944] Incorrect code generation with -Og

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jul 15 20:06:58 GMT 2024


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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
With -fPIC GCC assumes that a different definition of the functions might be
interposed later, so it emits a call (and assumes you're going to link to
another object which provides a definition without undefined behaviour).

If you use -fPIC -fno-semantic-interposition then you say that won't happen, so
GCC goes back to assuming you never call the function.

GCC seems to be working as designed.


More information about the Gcc-bugs mailing list