Add missing stride entry in debug info
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 11 Sep 2020 09:13:54 +0000 (11:13 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 11 Sep 2020 09:13:54 +0000 (11:13 +0200)
This adds a missing stride entry for bit-packed arrays of record types.

gcc/ada/ChangeLog:
* gcc-interface/misc.c (get_array_bit_stride): Return TYPE_ADA_SIZE
for record and union types.

gcc/ada/gcc-interface/misc.c

index e6a563e36667b00299522ca8bf3aa5c62347d3fc..781868e2ad3532474d7c3c0d85abf136890aed12 100644 (file)
@@ -1003,6 +1003,10 @@ get_array_bit_stride (tree comp_type)
   if (INTEGRAL_TYPE_P (comp_type))
     return TYPE_RM_SIZE (comp_type);
 
+  /* Likewise for record or union types.  */
+  if (RECORD_OR_UNION_TYPE_P (comp_type) && !TYPE_FAT_POINTER_P (comp_type))
+    return TYPE_ADA_SIZE (comp_type);
+
   /* The gnat_get_array_descr_info debug hook expects a debug tyoe.  */
   comp_type = maybe_debug_type (comp_type);