aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2025-07-28 22:16:08 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-09-11 11:10:50 +0200
commitc93fe0be50bcf622181b3036c89ebda0a71132d7 (patch)
tree7c0324d9ab46e739bbfa2cb97b2b58b1c8fcc59b
parent3a3854f3ea8ffcce624f064a137bacde03ab5efb (diff)
downloadgcc-c93fe0be50bcf622181b3036c89ebda0a71132d7.zip
gcc-c93fe0be50bcf622181b3036c89ebda0a71132d7.tar.gz
gcc-c93fe0be50bcf622181b3036c89ebda0a71132d7.tar.bz2
ada: Fix crash on reference to aliased object of packed array type with -g
This happens when the object is declared in another compilation unit. gcc/ada/ChangeLog: * gcc-interface/misc.cc (gnat_get_array_descr_info): In the record type case, bail out if the original array type cannot be retrieved.
-rw-r--r--gcc/ada/gcc-interface/misc.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc
index 7711f8b..a79b87e 100644
--- a/gcc/ada/gcc-interface/misc.cc
+++ b/gcc/ada/gcc-interface/misc.cc
@@ -837,6 +837,8 @@ gnat_get_array_descr_info (const_tree const_type,
if (TYPE_IMPL_PACKED_ARRAY_P (array_type)
&& TYPE_ORIGINAL_PACKED_ARRAY (array_type))
array_type = TYPE_ORIGINAL_PACKED_ARRAY (array_type);
+ if (TREE_CODE (array_type) != ARRAY_TYPE)
+ return false;
/* Shift back the address to get the address of the template. */
tree shift_amount