aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorRobin Dapp <rdapp@linux.ibm.com>2021-06-15 09:06:02 +0200
committerRobin Dapp <rdapp@linux.ibm.com>2021-06-15 09:12:55 +0200
commitba2eef033e59d80fde35d0cc3acf4d82f7706e60 (patch)
treedecf378f6ad15e1100d7317f31cc0bc033037980 /gcc/cp/decl.c
parent327a6b55e171669f2e72588570c931cd000822d0 (diff)
downloadgcc-ba2eef033e59d80fde35d0cc3acf4d82f7706e60.zip
gcc-ba2eef033e59d80fde35d0cc3acf4d82f7706e60.tar.gz
gcc-ba2eef033e59d80fde35d0cc3acf4d82f7706e60.tar.bz2
c-family: Copy DECL_USER_ALIGN even if DECL_ALIGN is similar.
When re-declaring a function with differing attributes DECL_USER_ALIGN is usually not merged/copied when DECL_ALIGN is similar. On s390 this will cause a warning message not to be shown. Similarly, we warned about the wrong alignment when short-circuiting an alignment initialization in common_handle_aligned_attribute (). Fix this by copying DECL_USER_ALIGN even if DECL_ALIGN is similar as well as getting rid of the short-circuited initialization. gcc/c-family/ChangeLog: * c-attribs.c (common_handle_aligned_attribute): Remove short circuit and dead code. gcc/c/ChangeLog: * c-decl.c (merge_decls): Copy DECL_USER_ALIGN if DECL_ALIGN is similar. gcc/cp/ChangeLog: * decl.c (duplicate_decls): Likewise.
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f5596b6..02772e9 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2805,6 +2805,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
SET_DECL_ALIGN (newdecl, DECL_ALIGN (olddecl));
DECL_USER_ALIGN (newdecl) |= DECL_USER_ALIGN (olddecl);
}
+ else if (DECL_ALIGN (olddecl) == DECL_ALIGN (newdecl)
+ && DECL_USER_ALIGN (olddecl) != DECL_USER_ALIGN (newdecl))
+ DECL_USER_ALIGN (newdecl) = 1;
+
DECL_USER_ALIGN (olddecl) = DECL_USER_ALIGN (newdecl);
if (DECL_WARN_IF_NOT_ALIGN (olddecl)
> DECL_WARN_IF_NOT_ALIGN (newdecl))