public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/52670] New: -mabi=ms generates bad code
@ 2012-03-22 15:52 dg at cowlark dot com
  2023-12-17  7:12 ` [Bug target/52670] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: dg at cowlark dot com @ 2012-03-22 15:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52670

             Bug #: 52670
           Summary: -mabi=ms generates bad code
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dg@cowlark.com


If I take this test case:

  int z(int i) { return i; }

...and compile it with:

  gcc-4.6 -Os -m32 -mabi=sysv -o test.s -c test.c -S -fomit-frame-pointer

...I get this (trimmed):

    movl    4(%esp), %eax
    ret

However, if I compile it with this:

  gcc-4.6 -Os -m32 -mabi=ms -o test.s -c test.c -S -fomit-frame-pointer

...then I get this, which is wrong:

    movl    36(%esp), %eax
    ret

Compiling with a copy of the Mingw compiler or with Visual C produces (the
equivalent of) the 4 result. The -fomit-frame-pointer is there purely to reduce
the size of the output; the bug persists without it. This appears to affect all
stack accesses. It *seems* to only apply to ia32 code. amd64 code appears to be
fine, but my target environment is ia32 only so I haven't looked into amd64
much.

This was discussed on gcc-help here:

  http://gcc.gnu.org/ml/gcc-help/2012-03/msg00281.html

This patch appears to fix the issue:

  http://gcc.gnu.org/ml/gcc-patches/2011-03/txt00118.txt

(although the patch needs a bit of work to apply).


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

* [Bug target/52670] -mabi=ms generates bad code
  2012-03-22 15:52 [Bug target/52670] New: -mabi=ms generates bad code dg at cowlark dot com
@ 2023-12-17  7:12 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-17  7:12 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0
         Resolution|---                         |FIXED
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed for GCC 4.7.0 by r0-107474-g6510e8bbf0b551 .

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

end of thread, other threads:[~2023-12-17  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-22 15:52 [Bug target/52670] New: -mabi=ms generates bad code dg at cowlark dot com
2023-12-17  7:12 ` [Bug target/52670] " pinskia 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).