diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2017-05-01 08:12:31 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2017-05-01 08:12:31 +0000 |
commit | 0a69d9bdc70e90bac8211099e950826b6999b75a (patch) | |
tree | f728bb79a0a77a0942e483f0ac9f69781b87dabd /gcc/ada/gcc-interface/decl.c | |
parent | 8d70063658f0159840e4605fff8181caf571c7d4 (diff) | |
download | gcc-0a69d9bdc70e90bac8211099e950826b6999b75a.zip gcc-0a69d9bdc70e90bac8211099e950826b6999b75a.tar.gz gcc-0a69d9bdc70e90bac8211099e950826b6999b75a.tar.bz2 |
decl.c (components_to_record): Add more comments.
* gcc-interface/decl.c (components_to_record): Add more comments.
Put back pending fields onto the regular list if the misalignment
happens to cancel itself.
From-SVN: r247426
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 0c9c78a..c243d40 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -7956,6 +7956,10 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type, different kinds of fields and issue a warning if some of them would be (or are being) reordered by the reordering mechanism. + Finally, pull out the fields whose size is not a multiple of a byte, so + that they don't cause the regular fields to be misaligned. As this can + only happen in packed record types, the alignment is capped to the byte. + ??? If we reorder them, debugging information will be wrong but there is nothing that can be done about this at the moment. */ const bool do_reorder = OK_To_Reorder_Components (gnat_record_type); @@ -8155,8 +8159,15 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type, in_variant, do_reorder); if (do_reorder) { + /* If we have pending bit-packed fields on the temporary list, we put + them either on the bit-packed list or back on the regular list. */ if (gnu_tmp_bitp_list) - gnu_bitp_list = chainon (gnu_tmp_bitp_list, gnu_bitp_list); + { + if (tmp_bitp_size != 0) + gnu_bitp_list = chainon (gnu_tmp_bitp_list, gnu_bitp_list); + else + gnu_field_list = chainon (gnu_tmp_bitp_list, gnu_field_list); + } gnu_field_list = chainon (gnu_field_list, |