[Bug ipa/95558] Invalid IPA optimizations based on weak definition

bugdal at aerifal dot cx gcc-bugzilla@gcc.gnu.org
Sat Jun 6 14:40:45 GMT 2020


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

--- Comment #3 from Rich Felker <bugdal at aerifal dot cx> ---
In addition to a fix, this is going to need a workaround as well. Do you have
ideas for a clean one? A dummy asm in the dummy function to kill pureness is
certainly a big hammer that would work, but it precludes LTO optimization if
the weak definition doesn't actually get replaced, so I don't like that.

One idea I think would work, but not sure: make an external __weak_dummy_tail
function that all the weak dummies tail call to. This should only take a few
bytes more than just returning, and precludes pureness analysis in the TU it's
in, while still allowing DCE at LTO time when the definition of
__weak_dummy_tail becomes available.

Is my reasoning correct here?


More information about the Gcc-bugs mailing list