public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55922] New: brace initializing parent cause bogus virtual base constructor calls
@ 2013-01-09 17:40 nicolas.cavallari at lri dot fr
  2013-01-09 17:43 ` [Bug c++/55922] " nicolas.cavallari at lri dot fr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nicolas.cavallari at lri dot fr @ 2013-01-09 17:40 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55922
           Summary: brace initializing parent cause bogus virtual base
                    constructor calls
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: nicolas.cavallari@lri.fr
              Host: x86_64-unknown-linux-gnu
            Target: x86_64-unknown-linux-gnu


Created attachment 29128
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29128
minimal program which does not work.

The attached minimal c++11 source compiles with g++ -std=c++11 minimal.c++, but
the program does not run as expected (indicated by a non-zero exit value).
Using clang works.

The same source with debug outputs shows that the virtual base constructor is
called more than once upon initialization with bogus 'this' pointers. Not all
classes agree on the offset to the virtual base. This causes silent member
corruption (and ultimately crashes if some of the members are pointers).

Replacing brace initializers for B1 and A2 with C++03 parentheses initializers
makes the problem go away.

Bug is also reproducible on trunk@195009 configured with ./configure
--enable-languages=c,c++ --prefix=...


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

end of thread, other threads:[~2021-08-10 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-09 17:40 [Bug c++/55922] New: brace initializing parent cause bogus virtual base constructor calls nicolas.cavallari at lri dot fr
2013-01-09 17:43 ` [Bug c++/55922] " nicolas.cavallari at lri dot fr
2015-06-25 10:16 ` redi at gcc dot gnu.org
2021-08-10 16:30 ` 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).