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 array types


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.

This is the new patch, tested by Paolo on x86-linux. OK for mainline?

Giovanni Bajo


cp/
        PR c++/19163
        * pt.c (tsubst): Propagate user alignment to the new array
        type.

testsuite/
        PR c++/19163
        * g++.dg/ext/align2.C, g++.dg/ext/align3.C,
        g++.dg/ext/align4.C: New testcases.

Attachment: patch-pr19163.txt
Description: Text document


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