diff options
author | Jason Merrill <jason@redhat.com> | 2015-04-28 10:43:48 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-04-28 10:43:48 -0400 |
commit | 7bfc5adac8d7151ed4c5ed13ed230f29c2102d9c (patch) | |
tree | 67cb947fcbac45db1e0afffa2d193017396302a4 /gcc/cp | |
parent | 544f7fc84123aa03d37cc5325576f0db51d94ef8 (diff) | |
download | gcc-7bfc5adac8d7151ed4c5ed13ed230f29c2102d9c.zip gcc-7bfc5adac8d7151ed4c5ed13ed230f29c2102d9c.tar.gz gcc-7bfc5adac8d7151ed4c5ed13ed230f29c2102d9c.tar.bz2 |
re PR c++/65734 (Yet another case of lost alignment by stor_layout)
PR c++/65734
gcc/
* stor-layout.c (layout_type): Layout the TYPE_MAIN_VARIANT.
(finalize_type_size): Respect TYPE_USER_ALIGN.
(layout_type) [ARRAY_TYPE]: Likewise.
gcc/cp/
* class.c (fixup_attribute_variants): Respect TYPE_USER_ALIGN.
From-SVN: r222529
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/class.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3f91187..b7c4720 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-04-28 Jason Merrill <jason@redhat.com> + + PR c++/65734 + * class.c (fixup_attribute_variants): Respect TYPE_USER_ALIGN. + 2015-04-27 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * class.c (layout_class_type): Remove check if diff --git a/gcc/cp/class.c b/gcc/cp/class.c index be5f5c2..c1548a0 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1989,14 +1989,23 @@ fixup_attribute_variants (tree t) if (!t) return; + tree attrs = TYPE_ATTRIBUTES (t); + unsigned align = TYPE_ALIGN (t); + bool user_align = TYPE_USER_ALIGN (t); + for (variants = TYPE_NEXT_VARIANT (t); variants; variants = TYPE_NEXT_VARIANT (variants)) { /* These are the two fields that check_qualified_type looks at and are affected by attributes. */ - TYPE_ATTRIBUTES (variants) = TYPE_ATTRIBUTES (t); - TYPE_ALIGN (variants) = TYPE_ALIGN (t); + TYPE_ATTRIBUTES (variants) = attrs; + unsigned valign = align; + if (TYPE_USER_ALIGN (variants)) + valign = MAX (valign, TYPE_ALIGN (variants)); + else + TYPE_USER_ALIGN (variants) = user_align; + TYPE_ALIGN (variants) = valign; } } |