]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Pass type of comparison operands instead of comparison result to truth_type_for in...
authorliuhongt <hongtao.liu@intel.com>
Wed, 25 Oct 2023 06:36:57 +0000 (14:36 +0800)
committerliuhongt <hongtao.liu@intel.com>
Thu, 26 Oct 2023 08:36:06 +0000 (16:36 +0800)
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.

gcc/c/c-typeck.cc
gcc/cp/typeck.cc

index 1eee653b3b8b7b49b29ef8d7f74718cebb697ddb..0de4662bfc6ce4614a2b892133f9a37b2d14d4d1 100644 (file)
@@ -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);
 }
index 3b719326d76c2fe74111b46354d37af95098919d..00570f170babd23266b3801298b0d6d558d0f4a2 100644 (file)
@@ -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);
 }