public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46317] New: Incorrect construction vtable on ARM in case of diamond shaped virtual inheritance
@ 2010-11-05 16:50 end3er at gmail dot com
  2010-11-05 16:55 ` [Bug c++/46317] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: end3er at gmail dot com @ 2010-11-05 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Incorrect construction vtable on ARM in case of
                    diamond shaped virtual inheritance
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: end3er@gmail.com


Created attachment 22295
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22295
Code that triggers the issue on ARM

This problem appears on ARM (not x86), with -O > 0.

The register R1 holding the pointer to the construction vtable for the
Parent-in-Child is actually pointing to the wrong Parent-in-Child vtable:

Let's assume we have a virtual base class A, two derived class B and C
virtually inheriting from A and a final class D derived virtually from B and
normally from C.

When instantiating D, the CTOR for B is called with R1 pointing to the
construction vtable for B-in-D instead of the one for C-in-D, which thus make
the program crash since it tries to access an uninitialized element of the
vtable for B when trying to access elements in C. 

A work-around for this issue is to compile with -fno-toplevel-reorder. It fixes
the problem for all optimizations level

This issue seems to be linked to #41354.


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

end of thread, other threads:[~2011-04-18 16:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-05 16:50 [Bug c++/46317] New: Incorrect construction vtable on ARM in case of diamond shaped virtual inheritance end3er at gmail dot com
2010-11-05 16:55 ` [Bug c++/46317] " pinskia at gcc dot gnu.org
2010-11-05 17:07 ` end3er at gmail dot com
2011-01-28 10:49 ` ibolton at gcc dot gnu.org
2011-01-28 22:22 ` end3er at gmail dot com
2011-01-28 22:36 ` end3er at gmail dot com
2011-01-29 18:27 ` mikpe at it dot uu.se
2011-01-30 17:51 ` end3er at gmail dot com
2011-04-18 16:11 ` rearnsha 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).