summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-28 16:28:59 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-28 16:28:59 +0000
commitd1b5d503596f383ca62622012930874f70e81930 (patch)
treefa89471443b3e494fbfea531664fc6a7d4c25fd5 /gcc/stor-layout.c
parenta9e0d79aebaf8c0caa7c61bc75d38f465ac453d3 (diff)
downloadgcc-d1b5d503596f383ca62622012930874f70e81930.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103583 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c22
1 files changed, 11 insertions, 11 deletions
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. */