]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix crash of -fdump-ada-spec in a pathological case
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 16 Jan 2024 11:15:31 +0000 (12:15 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Tue, 16 Jan 2024 11:17:32 +0000 (12:17 +0100)
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.

gcc/c-family/c-ada-spec.cc

index 7d886c0f92e97c47b85fddb1222dcc89e74ed886..4b245ed69754baf29d91ca080ffaf1633dd08e6f 100644 (file)
@@ -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)));