diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2017-09-09 12:48:41 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2017-09-09 12:48:41 +0000 |
commit | a713e7bb72617e88e9b2b64cecaffae7499146fb (patch) | |
tree | 6d468691713b6d0709526d1f49beecc5af7f9704 /gcc/ada/gcc-interface/decl.c | |
parent | 3d25b3ba49e73ea62920786f1785db6cfc4daa85 (diff) | |
download | gcc-a713e7bb72617e88e9b2b64cecaffae7499146fb.zip gcc-a713e7bb72617e88e9b2b64cecaffae7499146fb.tar.gz gcc-a713e7bb72617e88e9b2b64cecaffae7499146fb.tar.bz2 |
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
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index f8752c8..569e64d 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -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 self-referential/variable offset or misaligned. Note, in the latter 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 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, const bool do_reorder = (Convention (gnat_record_type) == Convention_Ada && !No_Reordering (gnat_record_type) + && (!Optimize_Alignment_Space (gnat_record_type) + || Is_Packed (gnat_record_type)) && !debug__debug_flag_dot_r); const bool w_reorder = (Convention (gnat_record_type) == Convention_Ada |