Commit 9bb45a95 by Jakub Jelinek Committed by Jakub Jelinek

re PR c/84853 (ICE: verify_gimple failed (expand_shift_1))

	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.

	* gcc.dg/pr84853.c: New test.

From-SVN: r258550
parent 8cb1151b
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
......
......@@ -11350,7 +11350,8 @@ build_binary_op (location_t location, enum tree_code code,
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;
......@@ -11408,7 +11409,8 @@ build_binary_op (location_t location, enum tree_code code,
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>
......
/* 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 >>" } */
}
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