From 462643f011112b0be9615d536f2fb1521a86a458 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Mon, 13 Aug 2007 13:06:15 -0700 Subject: [PATCH] re PR c/30427 (~ vector float is accepted) 2007-08-13 Andrew Pinski PR C/30427 * c-typeck.c (build_unary_op ): Reject vector float types. 2007-08-13 Andrew Pinski PR C/30427 * gcc.dg/vector-1.c: New test. From-SVN: r127396 --- gcc/ChangeLog | 6 ++++++ gcc/c-typeck.c | 5 ++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vector-1.c | 15 +++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/vector-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8cba1684fd..a2f92818320 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-08-13 Andrew Pinski + + PR C/30427 + * c-typeck.c (build_unary_op ): Reject vector float + types. + 2007-08-13 Nick Clifton * config/arm/arm_neon.h: Revert GPLv3 patch to this file. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 516314eb3c9..4fb70923d48 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -2832,7 +2832,10 @@ build_unary_op (enum tree_code code, tree xarg, int flag) break; case BIT_NOT_EXPR: - if (typecode == INTEGER_TYPE || typecode == VECTOR_TYPE) + /* ~ works on integer types and non float vectors. */ + if (typecode == INTEGER_TYPE + || (typecode == VECTOR_TYPE + && !VECTOR_FLOAT_TYPE_P (TREE_TYPE (arg)))) { if (!noconvert) arg = default_conversion (arg); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 542ac1a4abb..ccf4aacddb2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-08-13 Andrew Pinski + + PR C/30427 + * gcc.dg/vector-1.c: New test. + 2007-08-13 Richard Sandiford * gcc.dg/pr21255-4.c: Skip for PIC. diff --git a/gcc/testsuite/gcc.dg/vector-1.c b/gcc/testsuite/gcc.dg/vector-1.c new file mode 100644 index 00000000000..288dd1e924c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vector-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +/* Check for application of ~ on vector types. */ + +#define vector __attribute__((vector_size(16) )) + +vector float a; +vector int a1; + +int f(void) +{ + a = ~a; /* { dg-error "" } */ + a1 = ~a1; +}