https://gcc.gnu.org/g:0803a2d3d173cf0153d9c6777b42f54d2a193d96
commit 0803a2d3d173cf0153d9c6777b42f54d2a193d96 Author: Alexandre Oliva <ol...@adacore.com> Date: Thu Jun 27 09:10:29 2024 -0300 Follow only proper TYPE_DEBUG_TYPE TYPE_DEBUG_TYPE's storage is shared with other sorts of references to types, so it shouldn't be accessed unless TYPE_CAN_HAVE_DEBUG_TYPE_P holds. for gcc/ada/ChangeLog * gcc-interface/misc.cc (gnat_get_array_descr_info): Only follow TYPE_DEBUG_TYPE if TYPE_CAN_HAVE_DEBUG_TYPE_P. Diff: --- gcc/ada/gcc-interface/misc.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc index 4f6f6774fe7..f77629ce70b 100644 --- a/gcc/ada/gcc-interface/misc.cc +++ b/gcc/ada/gcc-interface/misc.cc @@ -967,7 +967,8 @@ gnat_get_array_descr_info (const_tree const_type, while (true) { - if (TYPE_DEBUG_TYPE (source_element_type)) + if (TYPE_CAN_HAVE_DEBUG_TYPE_P (source_element_type) + && TYPE_DEBUG_TYPE (source_element_type)) source_element_type = TYPE_DEBUG_TYPE (source_element_type); else if (TYPE_IS_PADDING_P (source_element_type)) source_element_type