public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1455] Fix crash on circular array types with -fdump switches
@ 2022-07-04 10:24 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2022-07-04 10:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:104b9875c7850c0587f1e96ee706da65ea1625be

commit r13-1455-g104b9875c7850c0587f1e96ee706da65ea1625be
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Mon Jul 4 12:16:38 2022 +0200

    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.

Diff:
---
 gcc/tree-pretty-print.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-pretty-print.cc b/gcc/tree-pretty-print.cc
index bfabe9e7627..47371d8bcbe 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))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-04 10:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 10:24 [gcc r13-1455] Fix crash on circular array types with -fdump switches Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).