Commit 5da8c011 by Eric Botcazou Committed by Eric Botcazou

layout.adb (Set_Elem_Alignment): Cap the alignment of access types to that of a…

layout.adb (Set_Elem_Alignment): Cap the alignment of access types to that of a regular access type for...

	* layout.adb (Set_Elem_Alignment): Cap the alignment of access types
	to that of a regular access type for non-strict-alignment platforms.
	* gcc-interface/utils.c (finish_fat_pointer_type): Do not set the
	alignment for non-strict-alignment platforms.

From-SVN: r190515
parent 08cb7d42
2012-08-19 Eric Botcazou <ebotcazou@adacore.com> 2012-08-19 Eric Botcazou <ebotcazou@adacore.com>
* layout.adb (Set_Elem_Alignment): Cap the alignment of access types
to that of a regular access type for non-strict-alignment platforms.
* gcc-interface/utils.c (finish_fat_pointer_type): Do not set the
alignment for non-strict-alignment platforms.
2012-08-19 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Use proper * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Use proper
dummy type for the temporary COMPONENT_REF built for a derived tagged dummy type for the temporary COMPONENT_REF built for a derived tagged
type with discriminant. type with discriminant.
......
...@@ -1369,7 +1369,8 @@ void ...@@ -1369,7 +1369,8 @@ void
finish_fat_pointer_type (tree record_type, tree field_list) finish_fat_pointer_type (tree record_type, tree field_list)
{ {
/* Make sure we can put it into a register. */ /* Make sure we can put it into a register. */
TYPE_ALIGN (record_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE); if (STRICT_ALIGNMENT)
TYPE_ALIGN (record_type) = MIN (BIGGEST_ALIGNMENT, 2 * POINTER_SIZE);
/* Show what it really is. */ /* Show what it really is. */
TYPE_FAT_POINTER_P (record_type) = 1; TYPE_FAT_POINTER_P (record_type) = 1;
......
...@@ -3118,6 +3118,19 @@ package body Layout is ...@@ -3118,6 +3118,19 @@ package body Layout is
if Esize (E) / SSU > Ttypes.Maximum_Alignment then if Esize (E) / SSU > Ttypes.Maximum_Alignment then
S := Ttypes.Maximum_Alignment; S := Ttypes.Maximum_Alignment;
-- If this is an access type and the target doesn't have strict
-- alignment and we are not doing front end layout, then cap the
-- alignment to that of a regular access type. This will avoid
-- giving fat pointers twice the usual alignment for no practical
-- benefit since the misalignment doesn't really matter.
elsif Is_Access_Type (E)
and then not Target_Strict_Alignment
and then not Frontend_Layout_On_Target
then
S := System_Address_Size / SSU;
else else
S := UI_To_Int (Esize (E)) / SSU; S := UI_To_Int (Esize (E)) / SSU;
end if; end if;
......
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