diff options
author | Jakub Jelinek <jakub@redhat.com> | 2015-04-09 17:06:56 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2015-04-09 17:06:56 +0200 |
commit | 00da5e285de9a4412a9ed6e73668234fa84e17fa (patch) | |
tree | be2f114d36e00d3f2062e49fb089f07e7a23b6b2 /gcc/cp | |
parent | fb728653b626594d13ae0fbf78e33c108cf8a8da (diff) | |
download | gcc-00da5e285de9a4412a9ed6e73668234fa84e17fa.zip gcc-00da5e285de9a4412a9ed6e73668234fa84e17fa.tar.gz gcc-00da5e285de9a4412a9ed6e73668234fa84e17fa.tar.bz2 |
re PR c++/65690 (typedef alignment lost since r219705)
PR c++/65690
* tree.c (build_cplus_array_type): Layout type before variants are
set, but copy over TYPE_SIZE and TYPE_SIZE_UNIT from the main
variant.
* c-c++-common/attr-aligned-1.c: New test.
From-SVN: r221952
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/tree.c | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b84f337..065cd75 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2015-04-09 Jakub Jelinek <jakub@redhat.com> + + PR c++/65690 + * tree.c (build_cplus_array_type): Layout type before variants are + set, but copy over TYPE_SIZE and TYPE_SIZE_UNIT from the main + variant. + 2015-04-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/64085 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 97bccc0..6802909 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -880,12 +880,19 @@ build_cplus_array_type (tree elt_type, tree index_type) { t = build_min_array_type (elt_type, index_type); set_array_type_canon (t, elt_type, index_type); + if (!dependent) + { + layout_type (t); + /* Make sure sizes are shared with the main variant. + layout_type can't be called after setting TYPE_NEXT_VARIANT, + as it will overwrite alignment etc. of all variants. */ + TYPE_SIZE (t) = TYPE_SIZE (m); + TYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (m); + } TYPE_MAIN_VARIANT (t) = m; TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); TYPE_NEXT_VARIANT (m) = t; - if (!dependent) - layout_type (t); } } |