This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix PR c++/68527


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
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))
 	    {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]