http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59037
--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to vries from comment #4) > Tentative patch: > ... > diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c > index 93b8970..6f2b4fb 100644 > --- a/gcc/tree-ssa-forwprop.c > +++ b/gcc/tree-ssa-forwprop.c > @@ -3046,6 +3046,8 @@ simplify_bitfield_ref (gimple_stmt_iterator *gsi) > if (TREE_CODE (m) != VECTOR_CST) > return false; > nelts = VECTOR_CST_NELTS (m); Add a comment here explaining why this isn't an assert? > + if (idx >= nelts) > + return false; > idx = TREE_INT_CST_LOW (VECTOR_CST_ELT (m, idx)); > idx %= 2 * nelts; > if (idx < nelts) I think it would be even better to fix whatever created that BIT_FIELD_REF, if you are motivated (though your patch isn't wrong).