aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2005-06-15 10:33:51 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2005-06-15 10:33:51 +0000
commit5bed876a0279849a661718d5a63c741652a4ecae (patch)
treecddc58e82c86c8f543c8c9fe3f96bcc986824672 /gcc/c-typeck.c
parentd7f88d86489c2d9868994347173c0b9d5f7ef285 (diff)
downloadgcc-5bed876a0279849a661718d5a63c741652a4ecae.zip
gcc-5bed876a0279849a661718d5a63c741652a4ecae.tar.gz
gcc-5bed876a0279849a661718d5a63c741652a4ecae.tar.bz2
c-common.h (same_scalar_type_ignoring_signedness): Protoize.
* c-common.h (same_scalar_type_ignoring_signedness): Protoize. * c-common.c (same_scalar_type_ignoring_signedness): New. * c-typeck.c (build_binary_op): Check compatability of vector types. Move error report after switch. Do not clobber code[01] on *_DIV_EXPR case. * testsuite/gcc.dg/simd-1.c: Update error messages. * testsuite/gcc.dg/simd-1b.c: Re-enable tests. Update error messages. * testsuite/gcc.dg/simd-2.c: Update error messages. * testsuite/gcc.dg/simd-4.c: New. From-SVN: r100976
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index fe56cf4..445193d 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -7548,12 +7548,14 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE
|| code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE))
{
+ enum tree_code tcode0 = code0, tcode1 = code1;
+
if (code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE)
- code0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0)));
+ tcode0 = TREE_CODE (TREE_TYPE (TREE_TYPE (op0)));
if (code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)
- code1 = TREE_CODE (TREE_TYPE (TREE_TYPE (op1)));
+ tcode1 = TREE_CODE (TREE_TYPE (TREE_TYPE (op1)));
- if (!(code0 == INTEGER_TYPE && code1 == INTEGER_TYPE))
+ if (!(tcode0 == INTEGER_TYPE && tcode1 == INTEGER_TYPE))
resultcode = RDIV_EXPR;
else
/* Although it would be tempting to shorten always here, that
@@ -7793,6 +7795,15 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
if (code0 == ERROR_MARK || code1 == ERROR_MARK)
return error_mark_node;
+ if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE
+ && (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1))
+ || !same_scalar_type_ignoring_signedness (TREE_TYPE (type0),
+ TREE_TYPE (type1))))
+ {
+ binary_op_error (code);
+ return error_mark_node;
+ }
+
if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE
|| code0 == VECTOR_TYPE)
&&