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
This commit is contained in:
Andrew Pinski 2007-08-14 02:24:26 -07:00 committed by Andrew Pinski
parent ab6328d08e
commit 9ef0c8d982
7 changed files with 70 additions and 2 deletions

View file

@ -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'.

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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;
}

View file

@ -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;
}