aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-03-31 08:49:09 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-03-31 08:49:09 +0000
commitefc3536f46d9c96daf1f12b587edc583445c3902 (patch)
tree809367d602e54509895a49dd738cec6ce2c7c8fb /gcc
parent4a4932eefd08070d9ef5d5fa79c9d343e876fd01 (diff)
downloadgcc-efc3536f46d9c96daf1f12b587edc583445c3902.zip
gcc-efc3536f46d9c96daf1f12b587edc583445c3902.tar.gz
gcc-efc3536f46d9c96daf1f12b587edc583445c3902.tar.bz2
re PR c++/70430 (Incorrect result for logical "and" operation with mixed vector and scalar)
2016-03-31 Richard Biener <rguenther@suse.de> PR c++/70430 * typeck.c (cp_build_binary_op): Fix operand order of vector conditional in truth op handling. * g++.dg/ext/vector30.C: New testcase. From-SVN: r234611
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/vector30.C15
4 files changed, 27 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 91ad5ac..96f0221 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-31 Richard Biener <rguenther@suse.de>
+
+ PR c++/70430
+ * typeck.c (cp_build_binary_op): Fix operand order of vector
+ conditional in truth op handling.
+
2016-03-29 Jason Merrill <jason@redhat.com>
PR c++/70353
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 447006c..9e61090 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4364,7 +4364,7 @@ cp_build_binary_op (location_t location,
{
tree m1 = build_all_ones_cst (TREE_TYPE (op0));
tree z = build_zero_cst (TREE_TYPE (op0));
- op1 = build_conditional_expr (location, op1, z, m1, complain);
+ op1 = build_conditional_expr (location, op1, m1, z, complain);
}
else if (!COMPARISON_CLASS_P (op1))
op1 = cp_build_binary_op (EXPR_LOCATION (op1), NE_EXPR, op1,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8e2bd73..7df13570 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-31 Richard Biener <rguenther@suse.de>
+
+ PR c++/70430
+ * g++.dg/ext/vector30.C: New testcase.
+
2016-03-30 Dominique d'Humieres <dominiq@lps.ens.fr>
Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/g++.dg/ext/vector30.C b/gcc/testsuite/g++.dg/ext/vector30.C
new file mode 100644
index 0000000..68326e3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector30.C
@@ -0,0 +1,15 @@
+// PR c++/70430
+// { dg-do run }
+extern "C" void abort (void);
+typedef int v4si __attribute__ ((vector_size (16)));
+int main()
+{
+ v4si b = {1,0,-1,2}, c;
+ c = b && 1;
+ if (c[0] != -1 || c[1] != 0 || c[2] != -1 || c[3] != -1)
+ abort ();
+ c = b && 0;
+ if (c[0] != 0 || c[1] != 0 || c[2] != 0 || c[3] != 0)
+ abort ();
+ return 0;
+}