* gcc-interface/decl.c (components_to_record): Add missing guard.
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 1 May 2017 08:24:40 +0000 (08:24 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 1 May 2017 08:24:40 +0000 (08:24 +0000)
From-SVN: r247427

gcc/ada/gcc-interface/decl.c

index c243d40d17bb95c308722c89770ee109e05f5b68..75b0475fe5e5bce94467c83e0d6baf8d3ee7e382 100644 (file)
@@ -8150,13 +8150,20 @@ components_to_record (Node_Id gnat_component_list, Entity_Id gnat_record_type,
       5) the variant part,
 
      within the record and within each variant recursively.  */
-  if (w_reorder
-      && last_reorder_field_type == 2
-      && tmp_last_reorder_field_type < 2)
-    warn_on_field_placement (gnu_tmp_bitp_list
-                            ? gnu_tmp_bitp_list : gnu_field_list,
-                            gnat_component_list, gnat_record_type,
-                            in_variant, do_reorder);
+
+  if (w_reorder)
+    {
+      /* If we have pending bit-packed fields, warn if they would be moved
+        to after regular fields.  */
+      if (last_reorder_field_type == 2
+         && tmp_bitp_size != 0
+         && tmp_last_reorder_field_type < 2)
+       warn_on_field_placement (gnu_tmp_bitp_list
+                                ? gnu_tmp_bitp_list : gnu_field_list,
+                                gnat_component_list, gnat_record_type,
+                                in_variant, do_reorder);
+    }
+
   if (do_reorder)
     {
       /* If we have pending bit-packed fields on the temporary list, we put