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)


Ping.

On Sun, May 25, 2014 at 11:30:51AM +0200, Marek Polacek wrote:
> On Mon, May 05, 2014 at 10:27:03PM +0200, Marek Polacek 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.
> > 
> > Note that the test is run only on i?86 and x86_64, because we can't (?)
> > easily determine which target requires what alignment.
> > 
> > Regtested/bootstrapped on x86_64-unknown-linux-gnu and
> > powerpc64-unknown-linux-gnu, ok for trunk?
> 
> Can I backport this one to 4.9?

	Marek


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