aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-11-29 17:48:58 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-11-29 10:48:58 -0700
commit673670da1e5dae2aaccbade88d540cf0200f0eb3 (patch)
tree6e9c098954bf73d9254094221f8aa7aee090062f /gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
parent2831adb5623797825234bf006b9f2fc8f027c36d (diff)
downloadgcc-673670da1e5dae2aaccbade88d540cf0200f0eb3.zip
gcc-673670da1e5dae2aaccbade88d540cf0200f0eb3.tar.gz
gcc-673670da1e5dae2aaccbade88d540cf0200f0eb3.tar.bz2
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
Diffstat (limited to 'gcc/testsuite/c-c++-common/builtin-has-attribute-3.c')
-rw-r--r--gcc/testsuite/c-c++-common/builtin-has-attribute-3.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c b/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
index 237dc72..f048059 100644
--- a/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
+++ b/gcc/testsuite/c-c++-common/builtin-has-attribute-3.c
@@ -35,7 +35,7 @@ ATTR (alias ("fnoreturn")) void falias (void);
void test_aligned (void)
{
A (0, fnone, aligned);
- A (0, fnone, aligned (0));
+ A (0, fnone, aligned (0)); /* { dg-warning "requested alignment .0. is not a positive power of 2" } */
A (0, fnone, aligned (1));
A (0, fnone, aligned (2));
A (0, fnone, aligned (4));
@@ -43,18 +43,18 @@ void test_aligned (void)
A (0, fnone, aligned (16));
A (1, faligned, aligned);
- A (0, faligned, aligned (0));
+ A (0, faligned, aligned (0)); /* { dg-warning "requested alignment .0. is not a positive power of 2" } */
A (0, faligned, aligned (1));
A (0, faligned, aligned (2));
A (1, faligned_1, aligned);
- A (0, faligned_1, aligned (0));
+ A (0, faligned_1, aligned (0)); /* { dg-warning "requested alignment .0. is not a positive power of 2" } */
A (1, faligned_1, aligned (1));
A (0, faligned_1, aligned (2));
A (0, faligned_1, aligned (4));
A (1, faligned_2, aligned);
- A (0, faligned_2, aligned (0));
+ A (0, faligned_2, aligned (0)); /* { dg-warning "requested alignment .0. is not a positive power of 2" } */
A (0, faligned_2, aligned (1));
A (1, faligned_2, aligned (2));
A (0, faligned_2, aligned (4));
@@ -193,18 +193,6 @@ void test_ctor_dtor (void)
A (1, fctor_dtor, constructor);
A (1, fctor_dtor, destructor);
-
- extern ATTR (constructor (123)) void fctor_123 (void);
- A (1, fctor_123, constructor);
- A (0, fctor_123, destructor);
- A (1, fctor_123, constructor (123));
- A (0, fctor_123, constructor (124));
-
- extern ATTR (destructor (234)) void fctor_123 (void);
- A (1, fctor_123, constructor (123));
- A (1, fctor_123, destructor);
- A (1, fctor_123, destructor (234));
- A (0, fctor_123, destructor (235));
}