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?
I should add that I checked what clang does on my testcase, and with this patch both compilers accept and reject the same sort of testcases, both with -m32 and -m64. Marek