This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ipa/81112] [7/8 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in get_len, at tree.h:5321
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 16 Jun 2017 12:05:18 +0000
- Subject: [Bug ipa/81112] [7/8 Regression] internal compiler error: tree check: expected integer_cst, have range_expr in get_len, at tree.h:5321
- Auto-submitted: auto-generated
- References: <bug-81112-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81112
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2017-06-16
Component|middle-end |ipa
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah, no. This is ipa-prop.c special code (bah).
Index: gcc/ipa-prop.c
===================================================================
--- gcc/ipa-prop.c (revision 249245)
+++ gcc/ipa-prop.c (working copy)
@@ -3030,7 +3030,10 @@ find_constructor_constant_at_offset (tre
if (index)
{
- off = wi::to_offset (index);
+ if (TREE_CODE (index) == RANGE_EXPR)
+ off = wi::to_offset (TREE_OPERAND (index, 0));
+ else
+ off = wi::to_offset (index);
if (TYPE_DOMAIN (type) && TYPE_MIN_VALUE (TYPE_DOMAIN (type)))
{
tree low_bound = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
@@ -3039,6 +3042,9 @@ find_constructor_constant_at_offset (tre
TYPE_PRECISION (TREE_TYPE (index)));
}
off *= wi::to_offset (unit_size);
+ if (TREE_CODE (index) == RANGE_EXPR)
+ off *= wi::sub (wi::to_offset (TREE_OPERAND (index, 1)),
+ wi::to_offset (TREE_OPERAND (index, 0)));
}
else
off = wi::to_offset (unit_size) * ix;
Fixes this.