It is a regression on the mainline for -fdump-ada-spec in a pathological case.

Tested on x86-64/Linux, applied on the mainline.


2024-01-16  Eric Botcazou  <ebotca...@adacore.com>

        PR ada/113397
        * c-ada-spec.cc (check_type_name_conflict): Add guard for the
        presence of DECL_NAME on a TYPE_DECL.
 
-- 
Eric Botcazou
diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc
index 7d886c0f92e..4b245ed6975 100644
--- a/gcc/c-family/c-ada-spec.cc
+++ b/gcc/c-family/c-ada-spec.cc
@@ -1566,6 +1566,8 @@ check_type_name_conflict (pretty_printer *buffer, tree t)
 	s = "";
       else if (TREE_CODE (TYPE_NAME (tmp)) == IDENTIFIER_NODE)
 	s = IDENTIFIER_POINTER (TYPE_NAME (tmp));
+      else if (!DECL_NAME (TYPE_NAME (tmp)))
+	s = "";
       else
 	s = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (tmp)));
 

Reply via email to