Commit f439f9a5 by J"orn Rennecke Committed by Joern Rennecke

re PR middle-end/23290 (Layout changed for structure with single complex field)

	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.

From-SVN: r104171
parent cd41bae5
2005-09-12 J"orn Rennecke <joern.rennecke@st.com> 2005-09-12 J"orn Rennecke <joern.rennecke@st.com>
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.
* sh.h (HARD_REGNO_MODE_OK): Allow V4SFmode in general purpose * sh.h (HARD_REGNO_MODE_OK): Allow V4SFmode in general purpose
registers for TARGET_SHMEDIA. registers for TARGET_SHMEDIA.
(enum reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS): Rename (enum reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS): Rename
......
...@@ -1367,14 +1367,15 @@ compute_record_mode (tree type) ...@@ -1367,14 +1367,15 @@ compute_record_mode (tree type)
#endif /* MEMBER_TYPE_FORCES_BLK */ #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 /* 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 matches the type's size. This only applies to RECORD_TYPE. This
does not apply to unions. */ does not apply to unions. */
if (TREE_CODE (type) == RECORD_TYPE && mode != VOIDmode 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; 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 /* If structure's known alignment is less than what the scalar
mode would need, and it matters, then stick with BLKmode. */ mode would need, and it matters, then stick with BLKmode. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment