public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix PR c++/68527
@ 2015-11-26 12:13 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2015-11-26 12:13 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

This is a tree checking failure on invalid C++ code with -fdump-ada-spec.
I guess that we could simply bail out if there are errors in the code, but we 
already have guards for error_mark_node so the patch adds a couple more.

Tested on x86_64-suse-linux, applied on the mainline as obvious.


2015-11-26  Eric Botcazou  <ebotcazou@adacore.com>

	PR c++/68527
	* c-ada-spec.c (dump_nested_types): Add guard for error_mark_node.
	(print_ada_struct_decl): Likewise.

-- 
Eric Botcazou

[-- Attachment #2: pr68527.diff --]
[-- Type: text/x-patch, Size: 1109 bytes --]

Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c	(revision 230924)
+++ c-family/c-ada-spec.c	(working copy)
@@ -2461,7 +2461,8 @@ dump_nested_types (pretty_printer *buffe
   field = TYPE_FIELDS (outer);
   while (field)
     {
-      if ((TREE_TYPE (field) != outer
+      if (((TREE_TYPE (field) != outer
+	    && TREE_TYPE (field) != error_mark_node)
 	   || (TREE_CODE (TREE_TYPE (field)) == POINTER_TYPE
 	       && TREE_TYPE (TREE_TYPE (field)) != outer))
 	   && (!TYPE_NAME (TREE_TYPE (field))
@@ -3230,9 +3231,10 @@ print_ada_struct_decl (pretty_printer *b
 		}
 	    }
 	  /* Avoid printing the structure recursively.  */
-	  else if ((TREE_TYPE (tmp) != node
-		   || (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE
-		       && TREE_TYPE (TREE_TYPE (tmp)) != node))
+	  else if (((TREE_TYPE (tmp) != node
+		     && TREE_TYPE (tmp) != error_mark_node)
+		    || (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE
+			&& TREE_TYPE (TREE_TYPE (tmp)) != node))
 		   && TREE_CODE (tmp) != TYPE_DECL
 		   && !TREE_STATIC (tmp))
 	    {

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

only message in thread, other threads:[~2015-11-26 12:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-26 12:13 Fix PR c++/68527 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).