+2018-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/84853
+ * c-typeck.c (build_binary_op) <case RSHIFT_EXPR, case LSHIFT_EXPR>:
+ If code1 is INTEGER_TYPE, only allow code0 VECTOR_TYPE if it has
+ INTEGER_TYPE element type.
+
2018-03-13 David Pagan <dave.pagan@oracle.com>
PR c/46921
converted = 1;
}
else if ((code0 == INTEGER_TYPE || code0 == FIXED_POINT_TYPE
- || code0 == VECTOR_TYPE)
+ || (code0 == VECTOR_TYPE
+ && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE))
&& code1 == INTEGER_TYPE)
{
doing_shift = true;
converted = 1;
}
else if ((code0 == INTEGER_TYPE || code0 == FIXED_POINT_TYPE
- || code0 == VECTOR_TYPE)
+ || (code0 == VECTOR_TYPE
+ && TREE_CODE (TREE_TYPE (type0)) == INTEGER_TYPE))
&& code1 == INTEGER_TYPE)
{
doing_shift = true;
-gcc/testsuite/ChangeLog:
+2018-03-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/84853
+ * gcc.dg/pr84853.c: New test.
2018-03-14 Carl Love <cel@us.ibm.com>
--- /dev/null
+/* PR c/84853 */
+/* { dg-do compile } */
+
+typedef float V __attribute__((__vector_size__ (16)));
+typedef int W __attribute__((__vector_size__ (16)));
+
+void
+foo (int x, V *y, V *z, W *w)
+{
+ *y = *y << x; /* { dg-error "invalid operands to binary <<" } */
+ *z = *z << *w; /* { dg-error "invalid operands to binary <<" } */
+}
+
+void
+bar (int x, V *y, V *z, W *w)
+{
+ *y = *y >> x; /* { dg-error "invalid operands to binary >>" } */
+ *z = *z >> *w; /* { dg-error "invalid operands to binary >>" } */
+}