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

Backported from mainline
	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.

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

From-SVN: r261922
This commit is contained in:
Jakub Jelinek 2018-06-22 22:40:45 +02:00 committed by Jakub Jelinek
parent 256768d447
commit e915c604c1
4 changed files with 38 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2018-06-22 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
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-01-25 Release Manager
* GCC 7.3.0 released.

View File

@ -11150,7 +11150,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;
@ -11207,7 +11208,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;

View File

@ -1,6 +1,11 @@
2018-06-22 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2018-03-15 Jakub Jelinek <jakub@redhat.com>
PR c/84853
* gcc.dg/pr84853.c: New test.
2018-03-13 Jakub Jelinek <jakub@redhat.com>
PR middle-end/84834

View File

@ -0,0 +1,19 @@
/* 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 >>" } */
}