This is the mail archive of the gcc-patches@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: C++ PATCH: PR 16405


Eric Botcazou wrote:

Whatever alignment it has, it has.  If the cast makes the alignment "2",
when it's really "4", then the change I made is an optimization because
it allows us to do the read more efficiently.  If the cast makes the
alignment "4", when it's really "2", then it's a lie, and the program
was invalid.


Well, in Ada we have "aligning" nodes that explicitly step up the alignment of an expression that is known to be over-aligned, but for which this can't be deduced from the expression itself. Removing these nodes may lead to the creation of unwanted temporaries later. See TYPE_ALIGN_OK.

So, you are saying that you might have an expression, of an object type, with an alignment of (say) 2, but then apply some casts that give an alignment of 4? Why not just set the alignment correctly on the original expression? And, are these types really compatible, in the sense of the langhook? Your point seems to be that you can't interchange the expressions; therefore, it seems, their types should not be considered compatible.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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