From f8629d35250f213e578495c341dee3940acea1b9 Mon Sep 17 00:00:00 2001 From: pinskia Date: Tue, 14 Aug 2007 09:24:26 +0000 Subject: [PATCH] 2007-08-14 Andrew Pinski 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 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 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 --- gcc/ChangeLog | 6 ++++++ gcc/c-typeck.c | 6 +++++- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/typeck.c | 4 +++- gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/g++.dg/ext/vector8.C | 21 +++++++++++++++++++++ gcc/testsuite/gcc.dg/vector-2.c | 21 +++++++++++++++++++++ 7 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/vector8.C create mode 100644 gcc/testsuite/gcc.dg/vector-2.c 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 + + 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 * 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 + + 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 * 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 + + 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 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; +} + -- 2.7.4