Commit 5dd2d985 by Marek Polacek Committed by Marek Polacek

re PR middle-end/81695 (internal compiler error: in size_binop_loc, at fold-const.c:1768)

	PR middle/81695
	* fold-const.c (fold_indirect_ref_1): Restore original behavior
	regarding size_zero_node.

From-SVN: r251119
parent c73200ca
2017-08-16 Marek Polacek <polacek@redhat.com>
PR middle/81695
* fold-const.c (fold_indirect_ref_1): Restore original behavior
regarding size_zero_node.
2017-08-16 Martin Liska <mliska@suse.cz> 2017-08-16 Martin Liska <mliska@suse.cz>
PR target/81753 PR target/81753
......
...@@ -14109,22 +14109,19 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0) ...@@ -14109,22 +14109,19 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
&& type == TREE_TYPE (op00type)) && type == TREE_TYPE (op00type))
{ {
tree type_domain = TYPE_DOMAIN (op00type); tree type_domain = TYPE_DOMAIN (op00type);
tree min; tree min = size_zero_node;
if (type_domain != NULL_TREE if (type_domain && TYPE_MIN_VALUE (type_domain))
&& (min = TYPE_MIN_VALUE (type_domain)) min = TYPE_MIN_VALUE (type_domain);
&& TREE_CODE (min) == INTEGER_CST) offset_int off = wi::to_offset (op01);
offset_int el_sz = wi::to_offset (TYPE_SIZE_UNIT (type));
offset_int remainder;
off = wi::divmod_trunc (off, el_sz, SIGNED, &remainder);
if (remainder == 0 && TREE_CODE (min) == INTEGER_CST)
{ {
offset_int off = wi::to_offset (op01); off = off + wi::to_offset (min);
offset_int el_sz = wi::to_offset (TYPE_SIZE_UNIT (type)); op01 = wide_int_to_tree (sizetype, off);
offset_int remainder; return build4_loc (loc, ARRAY_REF, type, op00, op01,
off = wi::divmod_trunc (off, el_sz, SIGNED, &remainder); NULL_TREE, NULL_TREE);
if (remainder == 0)
{
off = off + wi::to_offset (min);
op01 = wide_int_to_tree (sizetype, off);
return build4_loc (loc, ARRAY_REF, type, op00, op01,
NULL_TREE, NULL_TREE);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment