diff options
author | Jason Merrill <jason@redhat.com> | 2016-09-12 16:55:55 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-09-12 16:55:55 -0400 |
commit | e96809e33b89103bcd30c189599198a89d5a98e4 (patch) | |
tree | e98f4d24a4d7b19636f8622049a29ff5007747fe | |
parent | e1d55bf7870cac0625640e95450143fdacca7c35 (diff) | |
download | gcc-e96809e33b89103bcd30c189599198a89d5a98e4.zip gcc-e96809e33b89103bcd30c189599198a89d5a98e4.tar.gz gcc-e96809e33b89103bcd30c189599198a89d5a98e4.tar.bz2 |
Fix aligned-new tests on m68k.
* c-common.c (check_cxx_fundamental_alignment_constraints): Fix
bit/byte confusion, allow large alignment for types.
From-SVN: r240100
-rw-r--r-- | gcc/c-family/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 15 |
2 files changed, 14 insertions, 6 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 71c5e50..bfa606b3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2016-09-12 Jason Merrill <jason@redhat.com> + + * c-common.c (check_cxx_fundamental_alignment_constraints): Fix + bit/byte confusion, allow large alignment for types. + 2016-09-12 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/77496 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 2215e29..9b5e016 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -7836,8 +7836,7 @@ check_user_alignment (const_tree align, bool allow_zero) return i; } -/* - If in c++-11, check if the c++-11 alignment constraint with respect +/* If in c++-11, check if the c++-11 alignment constraint with respect to fundamental alignment (in [dcl.align]) are satisfied. If not in c++-11 mode, does nothing. @@ -7862,7 +7861,7 @@ check_cxx_fundamental_alignment_constraints (tree node, int flags) { bool alignment_too_large_p = false; - unsigned requested_alignment = 1U << align_log; + unsigned requested_alignment = (1U << align_log) * BITS_PER_UNIT; unsigned max_align = 0; if ((!(flags & ATTR_FLAG_CXX11) && !warn_cxx_compat) @@ -7906,15 +7905,19 @@ check_cxx_fundamental_alignment_constraints (tree node, } else if (TYPE_P (node)) { - /* Let's be liberal for types. */ - if (requested_alignment > (max_align = BIGGEST_ALIGNMENT)) + /* Let's be liberal for types. BIGGEST_ALIGNMENT is the largest + alignment a built-in type can require, MAX_OFILE_ALIGNMENT is the + largest alignment the object file can represent, but a type that is + only allocated dynamically could request even larger alignment. So + only limit type alignment to what TYPE_ALIGN can represent. */ + if (requested_alignment > (max_align = 8U << 28)) alignment_too_large_p = true; } if (alignment_too_large_p) pedwarn (input_location, OPT_Wattributes, "requested alignment %d is larger than %d", - requested_alignment, max_align); + requested_alignment / BITS_PER_UNIT, max_align / BITS_PER_UNIT); return !alignment_too_large_p; } |