[gcc(refs/users/aoliva/heads/testme)] make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

Alexandre Oliva aoliva@gcc.gnu.org
Fri Jun 28 08:43:59 GMT 2024


https://gcc.gnu.org/g:8f9705aadea6b840c9a1403a7497dde7bb586ce6

commit 8f9705aadea6b840c9a1403a7497dde7bb586ce6
Author: Alexandre Oliva <oliva@gnu.org>
Date:   Fri Jun 28 05:35:58 2024 -0300

    make_type_from_size avoid TYPE_DEBUG_TYPE / TREE_TYPE loops

Diff:
---
 gcc/ada/gcc-interface/utils.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index daf8d7ccdc5..b46e035e1d4 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -1427,10 +1427,12 @@ make_type_from_size (tree type, tree size_tree, bool for_biased)
       /* Enable us to avoid creating the same narrower type multiple
 	 times, and avoid duplication in debug information, by mapping
 	 the wider type to the narrower version.  If biasing is
-	 different, we use the narrower type for debug information.  */
+	 different, we use the narrower type for debug information.
+	 Be careful to avoid forming loops.  */
       if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)
 	  && !TYPE_DEBUG_TYPE (type)
-	  && biased_p == for_biased)
+	  && biased_p == for_biased
+	  && TREE_TYPE (new_type) != type)
 	SET_TYPE_DEBUG_TYPE (type, new_type);
 
       return new_type;


More information about the Gcc-cvs mailing list