C++ PATCH for c++/50618 (wrong-code with virtual bases)

Jason Merrill jason@redhat.com
Thu Oct 13 18:38:00 GMT 2011


When an object is value-initialized, if the type doesn't have a 
user-provided default constructor, the object is zero-initialized first, 
and then the synthesized constructor is called.  The problem in this PR 
was that when value-initializing a base in a constructor we were 
zero-initializing virtual bases of that base even though they had 
already been initialized properly.  The fix is to specify to 
build_zero_init_1 that we only want to clear the as-base portion of the 
type.

On the trunk I also tidied up the logic; on release branches I made the 
minimal change.  For the 4.4 branch I also needed to backport the fix 
for 48035.

Tested x86_64-pc-linux-gnu, applying to 4.4, 4.5, 4.6 and trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 50618.patch
Type: text/x-patch
Size: 2735 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111013/9474c22f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 50618-4.6.patch
Type: text/x-patch
Size: 1857 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111013/9474c22f/attachment-0001.bin>


More information about the Gcc-patches mailing list