This is the mail archive of the
mailing list for the GCC project.
Re: [C++ PATCH] [PR19163] Fix attribute aligned on dependent arraytypes
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Giovanni Bajo <giovannibajo at libero dot it>
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org, Paolo Carlini <pcarlini at suse dot de>
- Date: Mon, 03 Jan 2005 11:49:05 -0800
- Subject: Re: [C++ PATCH] [PR19163] Fix attribute aligned on dependent arraytypes
- Organization: CodeSourcery, LLC
- References: <022201c4ec60$62d4b820$394e2597@bagio> <20041227225753.GC5386@redhat.com> <031101c4ecc7$b1c21470$394e2597@bagio>
Giovanni Bajo wrote:
Richard Henderson <email@example.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
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