diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-03-15 08:37:53 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-03-15 08:37:53 +0100 |
commit | 9bb45a958d5281b3979f538a05ffa80c6833c4f7 (patch) | |
tree | 0138e2f3bf112fc983ceffbee9775c88c794fb80 | |
parent | 8cb1151b6063dbbe6bd255d3f16d0071d6095c38 (diff) | |
download | gcc-9bb45a958d5281b3979f538a05ffa80c6833c4f7.zip gcc-9bb45a958d5281b3979f538a05ffa80c6833c4f7.tar.gz gcc-9bb45a958d5281b3979f538a05ffa80c6833c4f7.tar.bz2 |
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
-rw-r--r-- | gcc/c/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr84853.c | 19 |
4 files changed, 34 insertions, 3 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 8147835..37a4177f 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +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 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 2ac8500..69ef470 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d815ea5..b2da077 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,7 @@ -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> diff --git a/gcc/testsuite/gcc.dg/pr84853.c b/gcc/testsuite/gcc.dg/pr84853.c new file mode 100644 index 0000000..c745263 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr84853.c @@ -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 >>" } */ +} |