On 10/5/18 4:56 PM, Martin Sebor wrote:
> While working on tests for an enhancement in the area of
> attributes I noticed that the handler for attribute assume_aligned
> (among others) does only a superficial job of detecting meaningless
> specifications such as using the attribute on a function returning
> void or alignments that aren't powers of two, out-of-range offsets,
> and so on. None of the expected warnings in the test case triggers
> (Clang diagnoses all of them).
>
> The attached patch improves the detection of these nonsensical
> constructs, and brings GCC closer to the more thorough job other
> compilers do. Tested on x86_64-linux.
>
> Martin
>
> gcc-87533.diff
>
> PR middle-end/87533 - bogus assume_aligned attribute silently accepted
>
> gcc/c-family/ChangeLog:
>
> PR middle-end/87533
> * c-attribs.c (handle_assume_aligned_attribute): Diagnose and
> reject invalid attribute specifications.
>
> gcc/testsuite/ChangeLog:
>
> PR middle-end/87533
> * gcc.dg/attr-assume_aligned-4.c: New test.
OK.
jeff