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] Don't reject valid code with _Alignas (PR c/61053)


On Tue, May 06, 2014 at 10:04:33AM +0200, Richard Biener wrote:
> On Mon, May 5, 2014 at 10:27 PM, Marek Polacek <polacek@redhat.com> wrote:
> > In this PR the issue is that we reject (valid) code such as
> > _Alignas (long long) long long foo;
> > with -m32, because we trip this condition:
> >
> >    alignas_align = 1U << declspecs->align_log;
> >    if (alignas_align < TYPE_ALIGN_UNIT (type))
> >      {
> >        if (name)
> >          error_at (loc, "%<_Alignas%> specifiers cannot reduce "
> >                    "alignment of %qE", name);
> >
> > and error later on, since alignas_align is 4 (correct, see PR52023 for
> > why), but TYPE_ALIGN_UNIT of long long is 8.  I think TYPE_ALIGN_UNIT
> > is wrong here as that won't give us minimal alignment required.
> > In c_sizeof_or_alignof_type we already have the code to compute such
> > minimal alignment so I just moved the code to a separate function
> > and used that instead of TYPE_ALIGN_UNIT.
> 
> Hmm, but isn't TYPE_ALIGN_UNIT wrong then?

No, after all, you don't want to change __alignof__ (long long), that is
pretty essential part of ABI.

	Jakub


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