https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90957
Bug ID: 90957 Summary: 453.povray is miscompiled with -flto -static Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: mkuvyrkov at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- Created attachment 46509 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46509&action=edit Script to reproduce 453.povray is miscompiled with -static -flto on arm-linux-gnueabihf. The failure confirmed vs trunk and gcc-8-branch, didn't check other releases. Failure seems to occur only when both -static -flto are used together; -Ox flags don't affect the outcome. I've reduce the problem to a single object povms.o. The failure occurs when povms.o is compiled with "-flto -static" and the rest of benchmark is compiled with "-static". Compiling povms.o with "-static" makes the failure go away. Attached is a script to reproduce: it uses Arm's pre-built cross-toolchain as base install and replaces compiler with a freshly built one. You need to supply your own sources of 453.povray and an aarch32 machine. Tested on armv7, but armv8 should do as well. # Produce good binary ./povray-build.sh true # Produce bad binary ./povray-build.sh false