From: liuhongt Date: Wed, 25 Oct 2023 06:36:57 +0000 (+0800) Subject: Pass type of comparison operands instead of comparison result to truth_type_for in... X-Git-Tag: basepoints/gcc-15~5199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f592b7b55b545ea4e3bd4fe88fc8d6fbfa3c5a5;p=thirdparty%2Fgcc.git Pass type of comparison operands instead of comparison result to truth_type_for in build_vec_cmp. gcc/c/ChangeLog: * c-typeck.cc (build_vec_cmp): Pass type of arg0 to truth_type_for. gcc/cp/ChangeLog: * typeck.cc (build_vec_cmp): Pass type of arg0 to truth_type_for. --- diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 1eee653b3b8b..0de4662bfc6c 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -11986,7 +11986,7 @@ build_vec_cmp (tree_code code, tree type, { tree zero_vec = build_zero_cst (type); tree minus_one_vec = build_minus_one_cst (type); - tree cmp_type = truth_type_for (type); + tree cmp_type = truth_type_for (TREE_TYPE (arg0)); tree cmp = build2 (code, cmp_type, arg0, arg1); return build3 (VEC_COND_EXPR, type, cmp, minus_one_vec, zero_vec); } diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 3b719326d76c..00570f170bab 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -4820,7 +4820,7 @@ build_vec_cmp (tree_code code, tree type, { tree zero_vec = build_zero_cst (type); tree minus_one_vec = build_minus_one_cst (type); - tree cmp_type = truth_type_for (type); + tree cmp_type = truth_type_for (TREE_TYPE (arg0)); tree cmp = build2 (code, cmp_type, arg0, arg1); return build3 (VEC_COND_EXPR, type, cmp, minus_one_vec, zero_vec); }