This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Don't reject valid code with _Alignas (PR c/61053)
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>, Richard Biener <rguenther at suse dot de>
- Date: Mon, 2 Jun 2014 08:52:57 +0200
- Subject: Re: [C PATCH] Don't reject valid code with _Alignas (PR c/61053)
- Authentication-results: sourceware.org; auth=none
- References: <20140505202703 dot GR11802 at redhat dot com> <20140525093051 dot GG17600 at redhat dot com>
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