public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikpe at it dot uu.se" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/55171] incorrect virtual thunk on mingw
Date: Sun, 11 Nov 2012 14:30:00 -0000	[thread overview]
Message-ID: <bug-55171-4-EOzk9jSccM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55171-4@http.gcc.gnu.org/bugzilla/>


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

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #5 from Mikael Pettersson <mikpe at it dot uu.se> 2012-11-11 14:30:14 UTC ---
It's caused by "[patch i386]: Set for method-functions default
calling-convention to thiscall for 32-bit msabi" in r171890:
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00066.html
http://gcc.gnu.org/ml/gcc-cvs/2011-04/msg00082.html

With x86_64-w64-mingw32-g++ -m32 -O2 there are numerous code generation
differences in r171890 for this test case (as expected with the changed calling
convention), but looking only at the virtual thunk we see:

--- pr55171.s-r171889   2012-11-11 14:51:38.000000000 +0100
+++ pr55171.s-r171890   2012-11-11 15:00:58.000000000 +0100
...
 __ZTv0_n16_NK7Derived3fooEv:
-       movl    8(%esp), %eax
-       movl    (%eax), %ecx
-       addl    -16(%ecx), %eax
-       movl    %eax, 8(%esp)
+       movl    4(%esp), %eax
+       movl    (%eax), %eax
+       addl    -16(%eax), %eax
+       movl    %eax, 4(%esp)
        jmp     LTHUNK2
...

The two code sequences are clearly not equivalent (ignore the stack position of
the pointer being adjusted).

Running the test case confirms: with g++ @ r171889 it succeeds, but with g++ @
r171890 it gets a runtime failure.


  parent reply	other threads:[~2012-11-11 14:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-01 21:11 [Bug c++/55171] New: " mitza at ociweb dot com
2012-11-02 11:13 ` [Bug c++/55171] " paolo.carlini at oracle dot com
2012-11-02 19:51 ` mitza at ociweb dot com
2012-11-02 20:13 ` [Bug target/55171] " paolo.carlini at oracle dot com
2012-11-07 21:10 ` mitza at ociweb dot com
2012-11-11 14:30 ` mikpe at it dot uu.se [this message]
2012-11-23 21:57 ` paolo.carlini at oracle dot com
2012-11-24 12:47 ` [Bug c++/55171] [4.7/4.8 Regression] " ktietz at gcc dot gnu.org
2012-11-24 12:54 ` ktietz at gcc dot gnu.org
2012-11-25 15:55 ` [Bug target/55171] " rguenth at gcc dot gnu.org
2012-11-29  9:19 ` ktietz at gcc dot gnu.org
2012-11-29  9:21 ` ktietz at gcc dot gnu.org
2012-11-29  9:25 ` ktietz at gcc dot gnu.org
2013-05-06  1:10 ` steve.k.chiu at gmail dot com
2013-05-06 22:31 ` i.nixman at gmail dot com

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-55171-4-EOzk9jSccM@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: link
Be 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).