https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117796
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target|x86_64-w64-mingw32 | Known to fail|10.2.0, 10.3.0, 11.1.0, | |11.3.0, 11.4.0, 11.5.0, | |12.1.0, 12.2.0, 12.3.0, | |12.4.0, 13.1.0, 13.2.0, | |13.3.0, 14.1.0, 14.2.0, | |9.3.0 | Host|x86_64-w64-mingw32 | Build|x86_64-w64-mingw32 | Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- > char (*f)(); ... f = some_unavailable_symbol; With -flto and the other options, f becomes local and then f is only written to so it is able to be removed. If you marked f as being used with the attribute used, then it would not have been removed.