diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-03-21 22:48:47 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-03-21 22:48:47 +0100 |
commit | aa1c94299c2b81f7728011ada92eb7761144b854 (patch) | |
tree | adb31ecef06999c3280ce6a8428edd5a4a32d542 /gcc | |
parent | e299d4fc1a9a3d30ed9c1b7df743b2fd84c9f03a (diff) | |
download | gcc-aa1c94299c2b81f7728011ada92eb7761144b854.zip gcc-aa1c94299c2b81f7728011ada92eb7761144b854.tar.gz gcc-aa1c94299c2b81f7728011ada92eb7761144b854.tar.bz2 |
re PR c/84999 (ICE in make_vector_type, at tree.c:9561)
PR c/84999
* c-typeck.c (build_binary_op): If c_common_type_for_size fails when
building vector comparison, diagnose it and return error_mark_node.
* c-c++-common/pr84999.c: New test.
From-SVN: r258747
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr84999.c | 12 |
4 files changed, 37 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 37a4177f..c1e204d 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2018-03-21 Jakub Jelinek <jakub@redhat.com> + + PR c/84999 + * c-typeck.c (build_binary_op): If c_common_type_for_size fails when + building vector comparison, diagnose it and return error_mark_node. + 2018-03-15 Jakub Jelinek <jakub@redhat.com> PR c/84853 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 69ef470..ffd0644 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -11504,6 +11504,13 @@ build_binary_op (location_t location, enum tree_code code, intt = c_common_type_for_size (GET_MODE_BITSIZE (SCALAR_TYPE_MODE (TREE_TYPE (type0))), 0); + if (!intt) + { + error_at (location, "could not find an integer type " + "of the same size as %qT", + TREE_TYPE (type0)); + return error_mark_node; + } result_type = build_opaque_vector_type (intt, TYPE_VECTOR_SUBPARTS (type0)); converted = 1; @@ -11665,6 +11672,13 @@ build_binary_op (location_t location, enum tree_code code, intt = c_common_type_for_size (GET_MODE_BITSIZE (SCALAR_TYPE_MODE (TREE_TYPE (type0))), 0); + if (!intt) + { + error_at (location, "could not find an integer type " + "of the same size as %qT", + TREE_TYPE (type0)); + return error_mark_node; + } result_type = build_opaque_vector_type (intt, TYPE_VECTOR_SUBPARTS (type0)); converted = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4c88b11..93dc7a2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-21 Jakub Jelinek <jakub@redhat.com> + + PR c/84999 + * c-c++-common/pr84999.c: New test. + 2018-03-21 Paolo Carlini <paolo.carlini@oracle.com> PR c++/84972 diff --git a/gcc/testsuite/c-c++-common/pr84999.c b/gcc/testsuite/c-c++-common/pr84999.c new file mode 100644 index 0000000..42d5376 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr84999.c @@ -0,0 +1,12 @@ +/* PR c/84999 */ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "" } */ + +typedef __float128 V __attribute__ ((__vector_size__ (2 * sizeof (__float128)))); +V a; +typeof (a != 0) b; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */ +typeof (a == 0) c; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */ +typeof (a < 0) d; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */ +typeof (a <= 0) e; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */ +typeof (a > 0) f; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */ +typeof (a >= 0) g; /* { dg-error "could not find an integer type of the same size as" "" { target ia32 } } */ |