public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/66655] New: [5.1 Regression]  miscompilation due to ipa-ra on MinGW
@ 2015-06-24 18:44 amonakov at gcc dot gnu.org
  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
  0 siblings, 2 replies; 3+ messages in thread
From: amonakov at gcc dot gnu.org @ 2015-06-24 18:44 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/66655] [5/6 Regression]  miscompilation due to ipa-ra on MinGW
  2015-06-24 18:44 [Bug target/66655] New: [5.1 Regression] miscompilation due to ipa-ra on MinGW amonakov at gcc dot gnu.org
@ 2015-06-25  7:58 ` rguenth at gcc dot gnu.org
  2015-07-16  9:17 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-06-25  7:58 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |5.1.0
   Target Milestone|---                         |5.2
            Summary|[5.1 Regression]            |[5/6 Regression]
                   |miscompilation due to       |miscompilation due to
                   |ipa-ra on MinGW             |ipa-ra on MinGW


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/66655] [5/6 Regression]  miscompilation due to ipa-ra on MinGW
  2015-06-24 18:44 [Bug target/66655] New: [5.1 Regression] miscompilation due to ipa-ra on MinGW amonakov at gcc dot gnu.org
  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
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-16  9:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 18:44 [Bug target/66655] New: [5.1 Regression] miscompilation due to ipa-ra on MinGW amonakov at gcc dot gnu.org
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

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).