diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 09:24:26 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 09:24:26 +0000 |
commit | f8629d35250f213e578495c341dee3940acea1b9 (patch) | |
tree | a270424e04da2ecb72822fd4aee45c1dd6c62cbe | |
parent | 330917d9ca104f5583394faa7cb0a3044bd2b2f3 (diff) | |
download | gcc-f8629d35250f213e578495c341dee3940acea1b9.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127477 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-typeck.c | 6 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/vector8.C | 21 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vector-2.c | 21 |
7 files changed, 70 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 08c819d6b49..72c9401fa14 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 4fb70923d48..9a63f1ec8ca 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 f7587f915d3..d7706afc7a4 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 944b1176da9..d2e095c634e 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 8b1e57f38e5..c55d2df2427 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 00000000000..5f9f9561d7f --- /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 00000000000..5f9f9561d7f --- /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; +} + |