This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix for segmentation violation in dump_generic_node
- From: Tom de Vries <vries at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 25 Aug 2011 12:32:22 +0200
- Subject: fix for segmentation violation in dump_generic_node
Jakub,
This patch fixes a segmentation violation, which occurs when printing a MEM_REF
or COMPONENT_REF containing a released ssa name. This can happen when we print
basic blocks upon removal, enabled by -ftree-dump-tree-*-details (see
remove_bb:tree-cfg.c).
Bootstrapped and reg-tested on x86_64.
OK for trunk?
Thanks,
- Tom
2011-08-25 Tom de Vries <tom@codesourcery.com>
* tree-pretty-print (dump_generic_node): Test for NULL_TREE before
accessing TREE_TYPE.
Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c (revision 176920)
+++ gcc/tree-pretty-print.c (working copy)
@@ -811,6 +811,8 @@ dump_generic_node (pretty_printer *buffe
&& TREE_CODE (TREE_OPERAND (node, 0)) != INTEGER_CST
/* Same pointer types, but ignoring POINTER_TYPE vs.
REFERENCE_TYPE. */
+ && TREE_TYPE (TREE_OPERAND (node, 0)) != NULL_TREE
+ && TREE_TYPE (TREE_OPERAND (node, 1)) != NULL_TREE
&& (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 0)))
== TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))
&& (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 0)))
@@ -1177,6 +1179,8 @@ dump_generic_node (pretty_printer *buffe
&& TREE_CODE (TREE_OPERAND (op0, 0)) != INTEGER_CST
/* Same pointer types, but ignoring POINTER_TYPE vs.
REFERENCE_TYPE. */
+ && TREE_TYPE (TREE_OPERAND (op0, 0)) != NULL_TREE
+ && TREE_TYPE (TREE_OPERAND (op0, 1)) != NULL_TREE
&& (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))
== TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))
&& (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 0)))