[Bug c++/48035] [4.4/4.5/4.6 Regression] Mismatch on size of class when initializing hierarchy involving virtual inheritance and empty base classes

2011-03-08 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48035

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2011.03.08 22:45:54
  Known to work||4.3.5
   Target Milestone|--- |4.4.6
Summary|Mismatch on size of class   |[4.4/4.5/4.6 Regression]
   |when initializing hierarchy |Mismatch on size of class
   |involving virtual   |when initializing hierarchy
   |inheritance and empty base  |involving virtual
   |classes |inheritance and empty base
   ||classes
 Ever Confirmed|0   |1
  Known to fail||4.4.5, 4.6.0

--- Comment #2 from Andrew Pinski  2011-03-08 
22:45:54 UTC ---
Confirmed, there was no valgrind errors in 4.3.5.


[Bug c++/48035] [4.4/4.5/4.6 Regression] Mismatch on size of class when initializing hierarchy involving virtual inheritance and empty base classes

2011-03-09 Thread dodji at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48035

Dodji Seketeli  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||dodji at gcc dot gnu.org


[Bug c++/48035] [4.4/4.5/4.6 Regression] Mismatch on size of class when initializing hierarchy involving virtual inheritance and empty base classes

2011-03-09 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48035

--- Comment #3 from Jakub Jelinek  2011-03-09 
12:46:12 UTC ---
I think this started with
http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138355


[Bug c++/48035] [4.4/4.5/4.6 Regression] Mismatch on size of class when initializing hierarchy involving virtual inheritance and empty base classes

2011-03-09 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48035

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  2011-03-09 
14:03:35 UTC ---
I think the problem is that build_zero_init isn't aware of the
DECL_FIELD_IS_BASE FIELD_DECLs and CLASSTYPE_AS_BASE stuff.  So when
simplify_aggr_init_expr decides to call build_zero_init on the
SpecificImplementation type, while the first FIELD_DECL has size 8 and its type
also size 8, the second FIELD_DECL has size 12 (CLASSTYPE_SIZE_UNIT), its type
has size 24 and thus what build_zero_init returns on the subtype isn't directly
usable as ctor of the outer type.


[Bug c++/48035] [4.4/4.5/4.6 Regression] Mismatch on size of class when initializing hierarchy involving virtual inheritance and empty base classes

2011-03-11 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48035

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P1


[Bug c++/48035] [4.4/4.5/4.6 Regression] Mismatch on size of class when initializing hierarchy involving virtual inheritance and empty base classes

2011-03-11 Thread jakub at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48035

--- Comment #5 from Jakub Jelinek  2011-03-11 
15:43:42 UTC ---
Author: jakub
Date: Fri Mar 11 15:43:37 2011
New Revision: 170874

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170874
Log:
PR c++/48035
* init.c (build_zero_init_1): Extracted from build_zero_init.
Add FIELD_SIZE argument, if non-NULL and field bit_position
as not smaller than that, don't add that field's initializer.
Pass DECL_SIZE as last argument to build_zero_init_1
for DECL_FIELD_IS_BASE fields.
(build_zero_init): Use build_zero_init_1.

* g++.dg/inherit/virtual8.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/inherit/virtual8.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/init.c
trunk/gcc/testsuite/ChangeLog