public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55171] New: incorrect virtual thunk on mingw
@ 2012-11-01 21:11 mitza at ociweb dot com
  2012-11-02 11:13 ` [Bug c++/55171] " paolo.carlini at oracle dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: mitza at ociweb dot com @ 2012-11-01 21:11 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55171
           Summary: incorrect virtual thunk on mingw
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mitza@ociweb.com


Created attachment 28593
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28593
test for virtual call on mingw

When a virtual call invoked on an object which uses both virtual and
non-virtual inheritance, the virtual thunk leaves the target function with an
invalid "this" pointer.

Attached test fails with output:

created Derived object at: 0x2c1a50
Derived virtual call at: 0x409800
Assertion failed!

>From gdb:
In the body of the most-derived constructor
(gdb) inf vt this
vtable for 'Derived' @ 0x4097ec (subobject @ 0x2c1a50):
[0]: 0x40188a <Derived::~Derived()>
[1]: 0x40190a <Derived::~Derived()>
[2]: 0x401932 <Derived::foo() const>

vtable for 'VirtBase' @ 0x409808 (subobject @ 0x2c1a58):
[0]: 0x401902 <virtual thunk to Derived::~Derived()>
[1]: 0x40192a <virtual thunk to Derived::~Derived()>
[2]: 0x4019d1 <virtual thunk to Derived::foo() const>

0x004019d1 in virtual thunk to Derived::foo() const () at gccbug.cpp:45
Dump of assembler code for function _ZTv0_n16_NK7Derived3fooEv:
=> 0x004019d1 <+0>:     mov    0x4(%esp),%eax
   0x004019d5 <+4>:     mov    (%eax),%eax
   0x004019d7 <+6>:     add    -0x10(%eax),%eax
   0x004019da <+9>:     mov    %eax,0x4(%esp)
   0x004019de <+13>:    jmp    0x401932 <Derived::foo() const>

After thunk has jumped to target function
Derived::foo (this=0x409800) at gccbug.cpp:41
41      {
(gdb) inf vt this
Cannot access memory at address 0xffffffec


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

end of thread, other threads:[~2013-05-06 22:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-01 21:11 [Bug c++/55171] New: incorrect virtual thunk on mingw 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
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

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