[Bug c++/41354] New: g++: Inlining constructors puts wrong vtable in objects

2009-09-14 Thread erik at arbat dot com
The GCC in Ubuntu Karmic for ARM uses the vtable of the superclass when
inlining the constructors of several subclasses in the same function.  This
happens only when using -fno-strict-aliasing.  This can cause the program to
fail with a "pure virtual called" error.  The V8 JavaScript engine is one
program that is vulnerable to this bug.

Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-3ubuntu3'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-objc-gc
--disable-sjlj-exceptions --with-arch=armv6 --with-tune=cortex-a8
--with-float=softfp --with-fpu=vfp --disable-werror --enable-checking=release
--build=arm-linux-gnueabi --host=arm-linux-gnueabi --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-3ubuntu3)


-- 
   Summary: g++: Inlining constructors puts wrong vtable in objects
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: erik at arbat dot com
 GCC build triplet: arm-linux-gnueabi
  GCC host triplet: arm-linux-gnueabi
GCC target triplet: arm-linux-gnueabi


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



[Bug c++/41354] g++: Inlining constructors puts wrong vtable in objects

2009-09-14 Thread erik at arbat dot com


--- Comment #1 from erik at arbat dot com  2009-09-14 09:00 ---
Created an attachment (id=18581)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18581&action=view)
Test case.

The following file illustrates the bug.  Compiling with
g++ -O1 -fno-strict-aliasing -c codegen.cc
to see the bug.  Compile with
g++ -O1 -fno-strict-aliasing -fno-tree-sink -c codegen.cc
to make the bug go away.  If you disassemble the two versions you can see that
in the buggy version both instances get the same vtable.  In the correct
version the constant pool is one word larger, as the two instances have two
different vtables.


-- 


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



[Bug middle-end/41354] g++: Inlining constructors puts wrong vtable in objects

2009-09-15 Thread erik at arbat dot com


--- Comment #3 from erik at arbat dot com  2009-09-15 13:22 ---
Created an attachment (id=18584)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18584&action=view)
Self-contained program demonstrating the issue.

Correct behaviour is to do nothing.
Incorrect behaviour is to crash with a pure virtual called error.


-- 

erik at arbat dot com changed:

   What|Removed |Added

  Attachment #18581|0   |1
is obsolete||


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