[gcc r14-7275] Fix crash of -fdump-ada-spec in a pathological case

Eric Botcazou ebotcazou@gcc.gnu.org
Tue Jan 16 11:17:49 GMT 2024


https://gcc.gnu.org/g:cf420e7b98d845323fad8280aea4ede60d3d96fe

commit r14-7275-gcf420e7b98d845323fad8280aea4ede60d3d96fe
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue Jan 16 12:15:31 2024 +0100

    Fix crash of -fdump-ada-spec in a pathological case
    
    gcc/c-family/
            PR ada/113397
            * c-ada-spec.cc (check_type_name_conflict): Add guard for the
            presence of DECL_NAME on a TYPE_DECL.

Diff:
---
 gcc/c-family/c-ada-spec.cc | 2 ++
 1 file changed, 2 insertions(+)

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)));


More information about the Gcc-cvs mailing list