public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amonakov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/66655] New: [5.1 Regression] miscompilation due to ipa-ra on MinGW Date: Wed, 24 Jun 2015 18:44:00 -0000 [thread overview] Message-ID: <bug-66655-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66655 Bug ID: 66655 Summary: [5.1 Regression] miscompilation due to ipa-ra on MinGW Product: gcc Version: unknown Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: amonakov at gcc dot gnu.org Target Milestone: --- Target: x86_64-w64-mingw32 Created attachment 35846 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35846&action=edit testcase Attached is a testcase that, when compiled with a MinGW GCC 5.1, aborts on execution. Swapping the order of .o files in the final link, or compiling main.cc with -O2 will produce a correct executable. The failure is caused by interplay of -fipa-ra (enabled by default at -O2) and MinGW's treatment of symbols that would normally be weak on ELF platforms. When compiling c.cc, ipa-ra does not save/restore %rax around the call to S::set (a static inline class method), apparently since the body emitted in that translation unit does not indeed clobber %rax and is not considered replaceable. On Linux, S::set is weak and optimization is not performed. However, S::set is also emitted when compiling main.cc, and its copy in main.o clobbers %rax since optimization is not enabled. During final link, the copy of S::set from main.o is used, producing a broken executable. (this issue is reduced from a miscompiled Clang produced by mingw-w64 5.1 cross-compiler)
next reply other threads:[~2015-06-24 18:44 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-24 18:44 amonakov at gcc dot gnu.org [this message] 2015-06-25 7:58 ` [Bug target/66655] [5/6 " rguenth at gcc dot gnu.org 2015-07-16 9:17 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-66655-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).