aboutsummaryrefslogtreecommitdiff
path: root/gcc/print-tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-06-11 08:40:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2019-06-11 08:40:08 -0400
commit92812757648109dc6cd35a52374ab3f6e9f44f78 (patch)
treeb10ff4fbd325eb277a8c2342eb2f325d56b91b60 /gcc/print-tree.c
parentde6abd8514fa7a2bed078935fd950f8cb8dee45c (diff)
downloadgcc-92812757648109dc6cd35a52374ab3f6e9f44f78.zip
gcc-92812757648109dc6cd35a52374ab3f6e9f44f78.tar.gz
gcc-92812757648109dc6cd35a52374ab3f6e9f44f78.tar.bz2
gdbhooks.py (TreePrinter.to_string): Recognize ggc_free'd memory.
* gdbhooks.py (TreePrinter.to_string): Recognize ggc_free'd memory. * tree.c (get_tree_code_name): Likewise. * print-tree.c (print_node): Only briefly print a node with an invalid code. From-SVN: r272150
Diffstat (limited to 'gcc/print-tree.c')
-rw-r--r--gcc/print-tree.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 81b66a1..f69a2c2 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -233,6 +233,15 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
return;
code = TREE_CODE (node);
+
+ /* It is unsafe to look at any other fields of a node with ERROR_MARK or
+ invalid code. */
+ if (code == ERROR_MARK || code >= MAX_TREE_CODES)
+ {
+ print_node_brief (file, prefix, node, indent);
+ return;
+ }
+
tclass = TREE_CODE_CLASS (code);
/* Don't get too deep in nesting. If the user wants to see deeper,
@@ -251,13 +260,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
return;
}
- /* It is unsafe to look at any other fields of an ERROR_MARK node. */
- if (code == ERROR_MARK)
- {
- print_node_brief (file, prefix, node, indent);
- return;
- }
-
/* Allow this function to be called if the table is not there. */
if (table)
{