aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-08-21 17:11:13 +0000
committerMarc Poulhiès <poulhies@adacore.com>2023-09-05 13:05:17 +0200
commit7f77d69bc86d25262b88503d0f5e3fff11c7898e (patch)
tree2f8af58ca90663c61148c31024bd2dbcc8c1cfc2 /gcc/ada/gcc-interface/decl.cc
parent10b4a454b2f5c2c3c6c98b4f7bf6bcf537c072cc (diff)
downloadgcc-7f77d69bc86d25262b88503d0f5e3fff11c7898e.zip
gcc-7f77d69bc86d25262b88503d0f5e3fff11c7898e.tar.gz
gcc-7f77d69bc86d25262b88503d0f5e3fff11c7898e.tar.bz2
ada: Fix DWARF for certain arrays
An array whose index type is a nonstandard enum will be marked as "packed", but should not emit DW_AT_bit_stride unless it is also bit-packed. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Set bit-packed for constrained and unconstrained array types. * gcc-interface/misc.cc (gnat_get_array_descr_info): Examine BIT_PACKED_ARRAY_TYPE_P.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.cc')
-rw-r--r--gcc/ada/gcc-interface/decl.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index ae756b3..0cf7d3c 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -2388,6 +2388,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
= (Is_Packed (gnat_entity)
|| Is_Packed_Array_Impl_Type (gnat_entity));
+ TYPE_BIT_PACKED_ARRAY_TYPE_P (tem)
+ = (Is_Packed_Array_Impl_Type (gnat_entity)
+ ? Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))
+ : Is_Bit_Packed_Array (gnat_entity));
+
if (Treat_As_Volatile (gnat_entity))
tem = change_qualified_type (tem, TYPE_QUAL_VOLATILE);
@@ -2815,7 +2820,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
TYPE_BIT_PACKED_ARRAY_TYPE_P (gnu_type)
= (Is_Packed_Array_Impl_Type (gnat_entity)
- && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity)));
+ ? Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))
+ : Is_Bit_Packed_Array (gnat_entity));
/* If the maximum size doesn't overflow, use it. */
if (gnu_max_size