middle-end/94465 - handle released SSA names in array_ref_low_bound

Message ID nycvar.YFH.7.76.2004031404130.830@zhemvz.fhfr.qr
State New
Headers show
Series
  • middle-end/94465 - handle released SSA names in array_ref_low_bound
Related show

Commit Message

Richard Biener April 3, 2020, 12:04 p.m.
array_ref_low_bound is used in dumping ARRAY_REFs which in turn
is called when basic blocks are deleted.  cleanup_control_flow_pre
consciously decides to remove unreachable basic-blocks in arbitrary
order so the following makes array_ref_low_bound forgiving in the
case the SSA name with the index definition has been released
already.

Boostrap / regtest running on x86_64-unknown-linux-gnu.

Richard.

2020-04-03  Richard Biener  <rguenther@suse.de>

	PR middle-end/94465
	* tree.c (array_ref_low_bound): Deal with released SSA names
	in index position.
---
 gcc/tree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.13.7

Patch

diff --git a/gcc/tree.c b/gcc/tree.c
index 63dc6730b2b..0fe3afce1b6 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -13426,7 +13426,9 @@  array_ref_low_bound (tree exp)
     return SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_MIN_VALUE (domain_type), exp);
 
   /* Otherwise, return a zero of the appropriate type.  */
-  return build_int_cst (TREE_TYPE (TREE_OPERAND (exp, 1)), 0);
+  tree idxtype = TREE_TYPE (TREE_OPERAND (exp, 1));
+  return (idxtype == error_mark_node
+	  ? integer_zero_node : build_int_cst (idxtype, 0));
 }
 
 /* Return a tree representing the upper bound of the array mentioned in