PR c/88172 - attribute aligned of zero silently accepted but ignored
authorMartin Sebor <msebor@redhat.com>
Thu, 29 Nov 2018 17:48:58 +0000 (17:48 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Thu, 29 Nov 2018 17:48:58 +0000 (10:48 -0700)
commit673670da1e5dae2aaccbade88d540cf0200f0eb3
tree6e9c098954bf73d9254094221f8aa7aee090062f
parent2831adb5623797825234bf006b9f2fc8f027c36d
PR c/88172 - attribute aligned of zero silently accepted but ignored

PR c/88172 - attribute aligned of zero silently accepted but ignored
PR testsuite/88208 - new test case c-c++-common/builtin-has-attribute-3.c in r266335 has multiple excess errors

gcc/ChangeLog:

PR c/88172
PR testsuite/88208
* doc/extend.texi (attribute constructor): Clarify.

gcc/c/ChangeLog:

PR c/88172
PR testsuite/88208
* c-decl.c (declspec_add_alignas): Adjust call to check_user_alignment.

gcc/c-family/ChangeLog:

PR c/88172
PR testsuite/88208
* c-attribs.c (common_handle_aligned_attribute): Silently avoid setting
alignments to values less than the target requires.
(has_attribute): For attribute aligned consider both the attribute
and the alignment bits.
* c-common.c (c_init_attributes): Optionally issue a warning for
zero alignment.

gcc/testsuite/ChangeLog:

PR c/88172
PR testsuite/88208
* gcc.dg/attr-aligned-2.c: New test.
* gcc.dg/builtin-has-attribute.c: Adjust.
* c-c++-common/builtin-has-attribute-2.c: Same.
* c-c++-common/builtin-has-attribute-3.c: Same.
* c-c++-common/builtin-has-attribute-4.c: Same.
* c-c++-common/builtin-has-attribute-5.c: New test.
* gcc.target/aarch64/attr-aligned.c: Same.
* gcc.target/i386/attr-aligned.c: Same.
* gcc.target/powerpc/attr-aligned.c: Same.
* gcc.target/sparc/attr-aligned.c: Same.

From-SVN: r266633
18 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-attribs.c
gcc/c-family/c-common.c
gcc/c/ChangeLog
gcc/c/c-decl.c
gcc/doc/extend.texi
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/builtin-has-attribute-2.c
gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
gcc/testsuite/c-c++-common/builtin-has-attribute-4.c
gcc/testsuite/c-c++-common/builtin-has-attribute-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/attr-aligned-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-has-attribute.c
gcc/testsuite/gcc.target/aarch64/attr-aligned.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/attr-aligned.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/attr-aligned.c [new file with mode: 0644]
gcc/testsuite/gcc.target/sparc/attr-aligned.c [new file with mode: 0644]