diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 758d4b2..85b1cd4 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -47,7 +47,7 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) if (TREE_STATIC (t) || DECL_EXTERNAL (t)) { varpool_mark_needed_node (varpool_node (t)); - if (lang_hooks.callgraph.analyze_expr) + if (lang_specifics_available) return lang_hooks.callgraph.analyze_expr (tp, walk_subtrees); } break; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index de63f1e..268a6f6 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3240,6 +3240,7 @@ tree cxx_callgraph_analyze_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED) { tree t = *tp; + gcc_assert (lang_specifics_available); switch (TREE_CODE (t)) { diff --git a/gcc/tree.c b/gcc/tree.c index c85825c..3706ebd 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3890,6 +3890,14 @@ reset_type_lang_specific (void **slot, void *unused ATTRIBUTE_UNUSED) tree type = *(tree *) slot; lang_hooks.reset_lang_specifics (type); + TREE_LANG_FLAG_0 (type) = 0; + TREE_LANG_FLAG_1 (type) = 0; + TREE_LANG_FLAG_2 (type) = 0; + TREE_LANG_FLAG_3 (type) = 0; + TREE_LANG_FLAG_4 (type) = 0; + TREE_LANG_FLAG_5 (type) = 0; + TREE_LANG_FLAG_6 (type) = 0; + if (TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == RECORD_TYPE) { @@ -4055,6 +4063,14 @@ reset_decl_lang_specific (void **slot, void *unused ATTRIBUTE_UNUSED) lang_hooks.reset_lang_specifics (decl); + TREE_LANG_FLAG_0 (decl) = 0; + TREE_LANG_FLAG_1 (decl) = 0; + TREE_LANG_FLAG_2 (decl) = 0; + TREE_LANG_FLAG_3 (decl) = 0; + TREE_LANG_FLAG_4 (decl) = 0; + TREE_LANG_FLAG_5 (decl) = 0; + TREE_LANG_FLAG_6 (decl) = 0; + if (context && TREE_CODE (context) == NAMESPACE_DECL) DECL_CONTEXT (decl) = context = NULL_TREE; @@ -4125,6 +4141,7 @@ reset_decl_lang_specific (void **slot, void *unused ATTRIBUTE_UNUSED) return 1; } +bool lang_specifics_available = true; /* Free resources that are used by FE but are not needed once they are done. */ static unsigned @@ -4146,6 +4163,7 @@ free_lang_specifics (void) a variant copy of ptr_type_node for front-end purposes. */ fileptr_type_node = ptr_type_node; + lang_specifics_available = false; return 0; } diff --git a/gcc/tree.h b/gcc/tree.h index dccb160..af07d01 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2774,6 +2774,7 @@ struct tree_decl_common GTY(()) struct lang_decl *lang_specific; }; +extern bool lang_specifics_available; extern tree decl_value_expr_lookup (tree); extern void decl_value_expr_insert (tree, tree);