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] [PR19163] Fix attribute aligned on dependent arraytypes


Giovanni Bajo wrote:
Richard Henderson <rth@redhat.com> wrote:


 r = build_cplus_array_type (type, domain);
+ TYPE_ALIGN (r) = TYPE_ALIGN (t);
+ TYPE_USER_ALIGN (r) = TYPE_USER_ALIGN (t);

Surely you only want to do this for TYPE_USER_ALIGN (t) == true? Otherwise, what alignment are you going to assign if the array element type is dependent? What alignment is "t" going to have that is going to apply to the new "r"?


You are right. My understanding was that TYPE_ALIGN was ignored (at this point)
if TYPE_USER_ALIGN was false, but it turns out I am wrong. Notice that
TYPE_USER_ALIGN is undocumented. It has a little comment in tree.h though.

First, I'm not very excited about making this change now, as it's not a regression fix. TR1 is nice, but certainly not 4.0-critical.


Second, I'm not sure that you've dealt with RTH's question fully. In the case that the original type is dependent, does TYPE_ALIGN (t) have a sensible value? And the documentation says that the "aligned" attribute can only increase alignment; how do we know that this constraint is being applied?

What we really want is a mechanism for storing up attributes on template declarations and applying them (perhaps after substitution) to template instantiations. I'm not sure that anything short of that solution makes sense.

--
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]