Commit f6d7e7d8 by Aldy Hernandez Committed by Aldy Hernandez

typeck.c (build_binary_op): Same.

	* typeck.c (build_binary_op): Same.
	* testsuite/g++.dg/conversion/simd3.C: New.

From-SVN: r100977
parent 5bed876a
2005-06-15 Aldy Hernandez <aldyh@redhat.com>
* typeck.c (build_binary_op): Same.
* testsuite/g++.dg/conversion/simd3.C: New.
2005-06-15 Nathan Sidwell <nathan@codesourcery.com>
PR c++/20678
......
......@@ -3181,8 +3181,13 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
/* Vector arithmetic is only allowed when both sides are vectors. */
if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)
{
if (!tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1)))
error ("can't convert between vector values of different size");
if (!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;
}
arithmetic_types_p = 1;
}
}
......
/* { dg-do compile } */
typedef int myint;
float __attribute__((vector_size(16))) b;
int __attribute__((vector_size(16))) d;
myint __attribute__((vector_size(16))) d2;
unsigned int __attribute__((vector_size(16))) e;
void foo()
{
b + d; /* { dg-error "invalid operands to binary" } */
d += e;
d2 += d;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment