https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66555
Bug ID: 66555 Summary: Fails to warn for if (j == 0 && i == i) Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: diagnostic Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- Just fixed a bug in the vectorizer with @@ -5359,7 +5373,7 @@ vectorizable_store (gimple stmt, gimple_ vect_finish_stmt_generation (stmt, incr, gsi); running_off = newoff; - if (j == 0 && i == i) + if (j == 0 && i == 0) STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = assign; else STMT_VINFO_RELATED_STMT (prev_stmt_info) = assign; and I wonder why we don't warn about this (well, I know, we only warn if the whole if expr folds to a constant). Applies to the C frontend as well.