aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-07-04 12:16:38 +0200
committerEric Botcazou <ebotcazou@adacore.com>2022-07-04 12:23:37 +0200
commit104b9875c7850c0587f1e96ee706da65ea1625be (patch)
tree4caa78327ec360ca75400f279e9124f8dc7985ef
parent483bd9a02831d9cb615179e5758946f41622d6c9 (diff)
downloadgcc-104b9875c7850c0587f1e96ee706da65ea1625be.zip
gcc-104b9875c7850c0587f1e96ee706da65ea1625be.tar.gz
gcc-104b9875c7850c0587f1e96ee706da65ea1625be.tar.bz2
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.
-rw-r--r--gcc/tree-pretty-print.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc
index bfabe9e..47371d8 100644
--- a/gcc/tree-pretty-print.cc
+++ b/gcc/tree-pretty-print.cc
@@ -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))