From 490272b4749bece4d79aeb99dd128ddc9c03c556 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 28 Aug 2005 09:28:59 -0700 Subject: [PATCH] stor-layout.c (finalize_type_size): Revert workaround from 08-26. * stor-layout.c (finalize_type_size): Revert workaround from 08-26. * tree.c (make_node_stat): Use BITS_PER_UNIT instead of alignment of char_type_node. From-SVN: r103583 --- gcc/ChangeLog | 6 ++++++ gcc/stor-layout.c | 22 +++++++++++----------- gcc/tree.c | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b69f7cde5f3..a218f58e02d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-08-28 Richard Henderson + + * stor-layout.c (finalize_type_size): Revert workaround from 08-26. + * tree.c (make_node_stat): Use BITS_PER_UNIT instead of alignment + of char_type_node. + 2005-08-28 Jakub Jelinek PR ada/23593 diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 81058558567..0ec818d7fbd 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -1399,23 +1399,23 @@ finalize_type_size (tree type) /* Normally, use the alignment corresponding to the mode chosen. However, where strict alignment is not required, avoid over-aligning structures, since most compilers do not do this - alignment. Also, we must avoid overriding a larger alignment - requirement coming from a user alignment of one of the fields. */ - /* ??? The non-aggregate code is also needed to reduce the alignment - of java types with alignment less than 16 bits. The problem stems - from java/decl.c using char_type_node for the 16 bit character type, - while tree.c:make_node uses it as the type of the smallest addressable - unit to initialize the alignment of all types. */ - unsigned mode_align = GET_MODE_ALIGNMENT (TYPE_MODE (type)); + alignment. */ if (TYPE_MODE (type) != BLKmode && TYPE_MODE (type) != VOIDmode - && ((STRICT_ALIGNMENT && mode_align >= TYPE_ALIGN (type)) + && (STRICT_ALIGNMENT || (TREE_CODE (type) != RECORD_TYPE && TREE_CODE (type) != UNION_TYPE && TREE_CODE (type) != QUAL_UNION_TYPE && TREE_CODE (type) != ARRAY_TYPE))) { - TYPE_ALIGN (type) = mode_align; - TYPE_USER_ALIGN (type) = 0; + unsigned mode_align = GET_MODE_ALIGNMENT (TYPE_MODE (type)); + + /* Don't override a larger alignment requirement coming from a user + alignment of one of the fields. */ + if (mode_align >= TYPE_ALIGN (type)) + { + TYPE_ALIGN (type) = mode_align; + TYPE_USER_ALIGN (type) = 0; + } } /* Do machine-dependent extra alignment. */ diff --git a/gcc/tree.c b/gcc/tree.c index 4ee70bf586b..124ef5a5d3d 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -488,7 +488,7 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) case tcc_type: TYPE_UID (t) = next_type_uid++; - TYPE_ALIGN (t) = char_type_node ? TYPE_ALIGN (char_type_node) : 0; + TYPE_ALIGN (t) = BITS_PER_UNIT; TYPE_USER_ALIGN (t) = 0; TYPE_MAIN_VARIANT (t) = t; -- 2.30.2