Hi!

As discussed in the PR, the ICE here happens in dump_generic_node:

    case FUNCTION_TYPE:
    case METHOD_TYPE:
...
      if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
        dump_decl_name (pp, TYPE_NAME (node), flags);

(gdb) print node
$21 = <function_type 0x7fffef652dc8 printfn_t>
(gdb) print node.type_common.name
$22 = <identifier_node 0x7fffef654730 printfn_t>

TYPE_NAME is an IDENTIFIER_NODE, whereas we're expecting a DECL_P, and bad things happen.

OK pending tests?
gcc/

	PR lto/84105
	* tree-pretty-print.c (dump_generic_node): Handle a TYPE_NAME with
	an IDENTIFIER_NODE for FUNCTION_TYPE's.

diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 54a8dfa3b6f..73eb27c8e8f 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1822,7 +1822,9 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
 	    pp_string (pp, "<null method basetype>");
 	  pp_colon_colon (pp);
 	}
-      if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
+      if (TYPE_IDENTIFIER (node))
+	dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
+      else if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
 	dump_decl_name (pp, TYPE_NAME (node), flags);
       else if (flags & TDF_NOUID)
 	pp_printf (pp, "<Txxxx>");

Reply via email to