https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61927
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- Hmm, we store MEM[(logical(kind=4) *)_227] = vect_patt_319.44_273; ... MEM[(logical(kind=4) *)_227 + 4B] = vect_patt_318.52_169; ... MEM[(logical(kind=4) *)_227 + 8B] = vect_patt_304.60_132; ... the result vectors 4 bytes apart but the vectors are 16byte V4SI ones. So we unroll the inner two loops and get for (i = 1; i <= 8; ++i) { symm_nonzero[i][0][0] = ABS ... > ...; ... repeated 9 times with other constant 2nd/3rd index ... } which we vectorize to a loop with two iterations but still 9 vector stores to symm_nonzero. This doesn't make much sense... it looks like SLP failed half-way. Or rather the vectorizer is somehow confused by the bool pattern detected: t.f90:42:0: note: pattern recognized: VIEW_CONVERT_EXPR<unsigned int>(symm_nonzero[_200]) = patt_319; with the VIEW_CONVERT_EXPR on the LHS which is not seen as grouped store. So it looks like vect_recog_bool_pattern does not handle grouped stores properly and Index: tree-vect-patterns.c =================================================================== --- tree-vect-patterns.c (revision 218019) +++ tree-vect-patterns.c (working copy) @@ -3261,6 +3261,8 @@ vect_recog_bool_pattern (vec<gimple> *st gcc_assert (vectype != NULL_TREE); if (!VECTOR_MODE_P (TYPE_MODE (vectype))) return NULL; + if (STMT_VINFO_GROUP_FIRST_ELEMENT (stmt_vinfo)) + return NULL; if (!check_bool_pattern (var, loop_vinfo, bb_vinfo)) return NULL; fixes this testcase (and then does not vectorize this loop). Any takers making this testcase suitable for the testsuite? It should abort() for bogus results and return normally for success. It should not output to the terminal.