Commit a713e7bb by Eric Botcazou Committed by Eric Botcazou

decl.c (components_to_record): Do not reorder in non- packed record types if...

	* gcc-interface/decl.c (components_to_record): Do not reorder in non-
	packed record types if pragma Optimize_Alignment (Space) is enabled.

From-SVN: r251936
parent 3d25b3ba
2017-09-09 Eric Botcazou <ebotcazou@adacore.com> 2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (components_to_record): Do not reorder in non-
packed record types if pragma Optimize_Alignment (Space) is enabled.
2017-09-09 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Subprogram_Body_to_gnu): Disregard inlining * gcc-interface/trans.c (Subprogram_Body_to_gnu): Disregard inlining
limits for expression functions. limits for expression functions.
(gnat_to_gnu) <N_Object_Declaration>: Fix formatting. (gnat_to_gnu) <N_Object_Declaration>: Fix formatting.
......
...@@ -7683,7 +7683,9 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type, ...@@ -7683,7 +7683,9 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type,
of a byte, so that they don't cause the regular fields to be either at of a byte, so that they don't cause the regular fields to be either at
self-referential/variable offset or misaligned. Note, in the latter self-referential/variable offset or misaligned. Note, in the latter
case, that this can only happen in packed record types so the alignment case, that this can only happen in packed record types so the alignment
is effectively capped to the byte for the whole record. is effectively capped to the byte for the whole record. But we don't
do it for non-packed record types if pragma Optimize_Alignment (Space)
is specified because this can prevent alignment gaps from being filled.
Optionally, if the layout warning is enabled, keep track of the above 4 Optionally, if the layout warning is enabled, keep track of the above 4
different kinds of fields and issue a warning if some of them would be different kinds of fields and issue a warning if some of them would be
...@@ -7694,6 +7696,8 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type, ...@@ -7694,6 +7696,8 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type,
const bool do_reorder const bool do_reorder
= (Convention (gnat_record_type) == Convention_Ada = (Convention (gnat_record_type) == Convention_Ada
&& !No_Reordering (gnat_record_type) && !No_Reordering (gnat_record_type)
&& (!Optimize_Alignment_Space (gnat_record_type)
|| Is_Packed (gnat_record_type))
&& !debug__debug_flag_dot_r); && !debug__debug_flag_dot_r);
const bool w_reorder const bool w_reorder
= (Convention (gnat_record_type) == Convention_Ada = (Convention (gnat_record_type) == Convention_Ada
......
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