[c-family] Fix PR ada/113397
Checks
Commit Message
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 <ebotcazou@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.
@@ -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)));