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.