This is the mail archive of the gcc@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]

Re: possible structure layout bug


Stephen Kennedy wrote:
Is there any particular reason that the packing rules for have been
changed from gcc-3.4 to gcc-3.5?

I would have thought that this would break the ABI. Unless it is fixing
existing breakage of course.
it is the latter case.
Base1 is non-pod, therefore its trailing padding can be overlaid by a
derived class.
Base2 is pod, therefore its trailing padding cannot be overlaid. The
gcc3.3 numbers show that it was being overlaid.

A program can legitimately use memcpy (x, y, sizeof (Base2))
to copy the Base2 part of a Derived2 object and not have that clobber
any other part of the Derived2 object.

Have you tested what 3.4 does?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



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