summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-12 13:49:56 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-12 13:49:56 +0000
commitc0d93be828e23ae2a5345e8863f9bc34a9d93164 (patch)
tree649fa30263261ba9370902d07bbae9c92afec4db /gcc/stor-layout.c
parentc3c6d729977cfc152109432fe4512f22f2bc4aba (diff)
downloadgcc-c0d93be828e23ae2a5345e8863f9bc34a9d93164.tar.gz
PR middle-end/23290
* stor-layout.c (compute_record_mode): For records with a single field, actually check the field's mode size against the type size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104171 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 0ec818d7fbd..31d8becdac7 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1367,14 +1367,15 @@ compute_record_mode (tree type)
#endif /* MEMBER_TYPE_FORCES_BLK */
}
- TYPE_MODE (type) = mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1);
-
/* If we only have one real field; use its mode if that mode's size
matches the type's size. This only applies to RECORD_TYPE. This
does not apply to unions. */
if (TREE_CODE (type) == RECORD_TYPE && mode != VOIDmode
- && GET_MODE_SIZE (mode) == GET_MODE_SIZE (TYPE_MODE (type)))
+ && host_integerp (TYPE_SIZE (type), 1)
+ && GET_MODE_BITSIZE (mode) == TREE_INT_CST_LOW (TYPE_SIZE (type)))
TYPE_MODE (type) = mode;
+ else
+ TYPE_MODE (type) = mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1);
/* If structure's known alignment is less than what the scalar
mode would need, and it matters, then stick with BLKmode. */