Fix crash on circular array types with -fdump switches

Such questionable arrays types can occur in Ada.

gcc/
	* tree-pretty-print.cc (dump_generic_node) <ARRAY_TYPE>: Add guard
	for direct circularity.
This commit is contained in:
Eric Botcazou 2022-07-04 12:16:38 +02:00
parent 483bd9a028
commit 104b9875c7
1 changed files with 5 additions and 1 deletions

View File

@ -2077,7 +2077,11 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
for (tmp = TREE_TYPE (node); TREE_CODE (tmp) == ARRAY_TYPE;
tmp = TREE_TYPE (tmp))
;
dump_generic_node (pp, tmp, spc, flags, false);
/* Avoid to print recursively the array. */
/* FIXME : Not implemented correctly, see print_struct_decl. */
if (TREE_CODE (tmp) != POINTER_TYPE || TREE_TYPE (tmp) != node)
dump_generic_node (pp, tmp, spc, flags, false);
/* Print the dimensions. */
for (tmp = node; TREE_CODE (tmp) == ARRAY_TYPE; tmp = TREE_TYPE (tmp))