https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70290
--- Comment #3 from Ilya Enkovich <ienkovich at gcc dot gnu.org> --- In build_conditional_expr_1 we check if used condition is a result of another VEC_COND_EXPR and then may just re-use condition of that VEC_COND_EXPR. In that case we deal with boolean vector as a condition type instead of integer vector. That confuses following type checkers since boolean vector size may not match integer vector size in case of scalar masks. I try a fix which always uses original condition type. It helps for both provided tests. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 1edbce8..d3a256c 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4634,6 +4634,8 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg1))) { + tree arg1_type = TREE_TYPE (arg1); + /* If arg1 is another cond_expr choosing between -1 and 0, then we can use its comparison. It may help to avoid additional comparison, produce more accurate diagnostics @@ -4653,7 +4655,6 @@ build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, || error_operand_p (arg3)) return error_mark_node; - tree arg1_type = TREE_TYPE (arg1); arg2_type = TREE_TYPE (arg2); arg3_type = TREE_TYPE (arg3);