This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/39981] zero-size base class optimization fails in certain scenarios



------- Comment #5 from navinkumar+bugs at gmail dot com  2009-11-06 19:58 -------
Any update on this?  zero-size base class optimization still fails on the same
scenario even with 4.4.2.

Where sizeof(_1_member) = 4,
compositeA1: _0_emptyA, _1_member, _2_emptyA  results in sizeof=4
compositeA2: _0_emptyA, _1_member             results in sizeof=4
compositeB1: _0_emptyB, _1_member             results in sizeof=4
compositeB2: _0_emptyB, _1_member, _2_emptyB  results in sizeof=8 ** NOT GOOD
**
compositeB3: _1_member, _2_emptyB             results in sizeof=4

Since compositeB1 _and_ compositeB3 are unaffected (their sizes are both 4
bytes), that means GCC is correctly interpreting emptyB as a candidate for
zero-size base class optimization, whether or not it is before or after
_1_member. For some reason, in compositeB2, GCC is not applying zero-size base
class optimization with one of the two emptyBs.

Since compositeA1 is unaffected (its size is 4 bytes), that means GCC can
correctly apply zero-size base class optimization on multiple base classes.

For some reason, despite GCC's ability to correctly do most of the scenarios
(therefore ruling out issues of padding/alignment/non-POD problems), it fails
with compositeB2.


-- 

navinkumar+bugs at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.3.3 4.4.0 4.4.2
            Version|4.4.0                       |4.4.2


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]