aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gmail.com>2007-08-14 02:24:26 -0700
committerAndrew Pinski <pinskia@gcc.gnu.org>2007-08-14 02:24:26 -0700
commit9ef0c8d982bff201b518d99a900e7f7434ed33c9 (patch)
treea270424e04da2ecb72822fd4aee45c1dd6c62cbe /gcc
parentab6328d08ef84c5b98c78a1e439f62d88edf4eb6 (diff)
downloadgcc-9ef0c8d982bff201b518d99a900e7f7434ed33c9.zip
gcc-9ef0c8d982bff201b518d99a900e7f7434ed33c9.tar.gz
gcc-9ef0c8d982bff201b518d99a900e7f7434ed33c9.tar.bz2
re PR c/30428 (vector float | vector float is accepted)
2007-08-14 Andrew Pinski <pinskia@gmail.com> PR c/30428 * c-typeck.c (build_binary_op): Disallow vector float types with BIT_IOR_EXPR, BIT_AND_EXPR, and BIT_XOR_EXPR. 2007-08-14 Andrew Pinski <pinskia@gmail.com> PR c++/30428 * typeck.c (build_binary_op): Disallow vector float types with BIT_IOR_EXPR, BIT_AND_EXPR, and BIT_XOR_EXPR. 2007-08-14 Andrew Pinski <pinskia@gmail.com> PR c/30428 * gcc.dg/vector-2.c: New test. PR c++/30428 * g++.dg/ext/vector8.C: New test. From-SVN: r127477
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-typeck.c6
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c4
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/ext/vector8.C21
-rw-r--r--gcc/testsuite/gcc.dg/vector-2.c21
7 files changed, 70 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 08c819d..72c9401 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2007-08-14 Andrew Pinski <pinskia@gmail.com>
+
+ PR c/30428
+ * c-typeck.c (build_binary_op): Disallow vector float types with
+ BIT_IOR_EXPR, BIT_AND_EXPR, and BIT_XOR_EXPR.
+
2007-08-14 Maxim Kuvyrkov <maxim@codesourcery.com>
* sched-int.h (struct _dep): Rename field 'kind' to 'type'.
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 4fb7092..9a63f1e 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -7892,7 +7892,11 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
case BIT_XOR_EXPR:
if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
shorten = -1;
- else if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
+ /* Allow vector types which are not floating point types. */
+ else if (code0 == VECTOR_TYPE
+ && code1 == VECTOR_TYPE
+ && !VECTOR_FLOAT_TYPE_P (type0)
+ && !VECTOR_FLOAT_TYPE_P (type1))
common = 1;
break;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f7587f9..d7706af 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2007-08-14 Andrew Pinski <pinskia@gmail.com>
+
+ PR c++/30428
+ * typeck.c (build_binary_op): Disallow vector float types with
+ BIT_IOR_EXPR, BIT_AND_EXPR, and BIT_XOR_EXPR.
+
2007-08-11 Ian Lance Taylor <iant@google.com>
* cp-objcp-common.c (cxx_get_alias_set): Change return type to
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 944b117..d2e095c 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3214,7 +3214,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
if ((code0 == INTEGER_TYPE && code1 == INTEGER_TYPE)
- || (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE))
+ || (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+ && !VECTOR_FLOAT_TYPE_P (type0)
+ && !VECTOR_FLOAT_TYPE_P (type1)))
shorten = -1;
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8b1e57f..c55d2df 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-14 Andrew Pinski <pinskia@gmail.com>
+
+ PR c/30428
+ * gcc.dg/vector-2.c: New test.
+
+ PR c++/30428
+ * g++.dg/ext/vector8.C: New test.
+
2007-08-13 Dan Hipschman <dsh@google.com>
PR c/32953
diff --git a/gcc/testsuite/g++.dg/ext/vector8.C b/gcc/testsuite/g++.dg/ext/vector8.C
new file mode 100644
index 0000000..5f9f956
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector8.C
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Check for application of |, ^, and & on vector types. */
+#define vector __attribute__((vector_size(16) ))
+
+vector float a;
+vector int a1;
+vector float b;
+vector int b1;
+
+int f(void)
+{
+ a = a | b; /* { dg-error "" } */
+ a = a & b; /* { dg-error "" } */
+ a = a ^ b; /* { dg-error "" } */
+ a1 = a1 | b1;
+ a1 = a1 & b1;
+ a1 = a1 ^ b1;
+}
+
diff --git a/gcc/testsuite/gcc.dg/vector-2.c b/gcc/testsuite/gcc.dg/vector-2.c
new file mode 100644
index 0000000..5f9f956
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vector-2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Check for application of |, ^, and & on vector types. */
+#define vector __attribute__((vector_size(16) ))
+
+vector float a;
+vector int a1;
+vector float b;
+vector int b1;
+
+int f(void)
+{
+ a = a | b; /* { dg-error "" } */
+ a = a & b; /* { dg-error "" } */
+ a = a ^ b; /* { dg-error "" } */
+ a1 = a1 | b1;
+ a1 = a1 & b1;
+ a1 = a1 ^ b1;
+}
+