aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-05-21 10:57:02 +0200
committerEric Botcazou <ebotcazou@adacore.com>2021-05-21 10:57:02 +0200
commitdd9a8fff14eda90fcaa3ac4b6b68ceded72a6af5 (patch)
treeba38229e447b4a18f53b1cbdf224673a4e8c1b68 /gcc/ada
parent932198a8e1b6ab26201a265ced3a8c4802304146 (diff)
downloadgcc-dd9a8fff14eda90fcaa3ac4b6b68ceded72a6af5.zip
gcc-dd9a8fff14eda90fcaa3ac4b6b68ceded72a6af5.tar.gz
gcc-dd9a8fff14eda90fcaa3ac4b6b68ceded72a6af5.tar.bz2
Fix internal error on locally derived bit-packed array type
This is a regression present on the mainline, 11 and 10 branches, in the form of an ICE on a locally derived bit-packed array type. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Process the implementation type of a packed type implemented specially. gcc/testsuite/ * gnat.dg/derived_type7.adb, gnat.dg/derived_type7.ads: New test.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/gcc-interface/decl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 19e851f..8d3c16c 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -2345,11 +2345,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
set_nonaliased_component_on_array_type (tem);
}
- /* If an alignment is specified, use it if valid. But ignore it
- for the original type of packed array types. If the alignment
- was requested with an explicit alignment clause, state so. */
- if (No (Packed_Array_Impl_Type (gnat_entity))
- && Known_Alignment (gnat_entity))
+ /* If this is a packed type implemented specially, then process the
+ implementation type so it is elaborated in the proper scope. */
+ if (Present (Packed_Array_Impl_Type (gnat_entity)))
+ gnat_to_gnu_entity (Packed_Array_Impl_Type (gnat_entity), NULL_TREE,
+ false);
+
+ /* Otherwise, if an alignment is specified, use it if valid and, if
+ the alignment was requested with an explicit clause, state so. */
+ else if (Known_Alignment (gnat_entity))
{
SET_TYPE_ALIGN (tem,
validate_alignment (Alignment (gnat_entity),