From 89a01fcf4cff990c0d25d048ae01abb476070d05 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 26 Nov 2015 12:04:50 +0000 Subject: [PATCH] re PR c++/68527 (ICE with -fdump-ada-spec on invalid C++ 11 code) PR c++/68527 * c-ada-spec.c (dump_nested_types): Add guard for error_mark_node. (print_ada_struct_decl): Likewise. From-SVN: r230942 --- gcc/c-family/ChangeLog | 6 ++++++ gcc/c-family/c-ada-spec.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 6e7b0f761f2..595fc3a9d63 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2015-11-26 Eric Botcazou + + PR c++/68527 + * c-ada-spec.c (dump_nested_types): Add guard for error_mark_node. + (print_ada_struct_decl): Likewise. + 2015-11-23 Igor Zamyatin PR c++/68001 diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index e85c1a9a7d5..3726a681fa9 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -2461,7 +2461,8 @@ dump_nested_types (pretty_printer *buffer, tree t, tree parent, bool forward, 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 *buffer, tree node, tree type, int spc, } } /* 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)) { -- 2.30.2