https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112374
--- Comment #29 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/tree-vect-loop.cc.jj 2023-11-14 10:35:52.000000000 +0100 +++ gcc/tree-vect-loop.cc 2023-11-15 22:42:32.782007408 +0100 @@ -4105,9 +4105,9 @@ pop: /* In case of a COND_OP (mask, op1, op2, op1) reduction we might have op1 twice (once as definition, once as else) in the same operation. Allow this. */ - if (cond_fn_p) + if (cond_fn_p && op_use_stmt == use_stmt) { - gcall *call = dyn_cast<gcall *> (use_stmt); + gcall *call = as_a<gcall *> (use_stmt); unsigned else_pos = internal_fn_else_index (internal_fn (op.code)); doesn't cure the -fcompare-debug failure though.