diff options
author | Richard Biener <rguenther@suse.de> | 2024-10-01 11:22:17 +0200 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2024-10-01 12:52:21 +0200 |
commit | 60fa7f51c84f042af70a3feea14236c102d6a9c2 (patch) | |
tree | afeab54df03c9fdb6652089986b023171a14a77f | |
parent | 3e1bd6470e4deba1a3ad14621037098311ad1350 (diff) | |
download | gcc-60fa7f51c84f042af70a3feea14236c102d6a9c2.zip gcc-60fa7f51c84f042af70a3feea14236c102d6a9c2.tar.gz gcc-60fa7f51c84f042af70a3feea14236c102d6a9c2.tar.bz2 |
tree-optimization/116905 - ICE with bogus range ops
The following avoids querying ranges of vector entities.
PR tree-optimization/116905
* tree-vect-stmts.cc (supportable_indirect_convert_operation):
Fix guard for vect_get_range_info.
* gcc.dg/pr116905.c: New testcase.
-rw-r--r-- | gcc/testsuite/gcc.dg/pr116905.c | 14 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.cc | 6 |
2 files changed, 18 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/pr116905.c b/gcc/testsuite/gcc.dg/pr116905.c new file mode 100644 index 0000000..0a2b96a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr116905.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target float16 } */ +/* { dg-options "-frounding-math" } */ +/* { dg-additional-options "-mavx" { target avx } } */ + +typedef __attribute__((__vector_size__(16))) _Float16 F; +typedef __attribute__((__vector_size__(32))) int V; +F f; + +void +foo() +{ + f += __builtin_convertvector((V){3307}, F); +} diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 540a9b7..b880f05 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -14803,8 +14803,10 @@ supportable_indirect_convert_operation (code_helper code, In the future, if it is supported, changes may need to be made to this part, such as checking the RANGE of each element in the vector. */ - if ((TREE_CODE (op0) == SSA_NAME && !SSA_NAME_RANGE_INFO (op0)) - || !vect_get_range_info (op0, &op_min_value, &op_max_value)) + if (TREE_CODE (op0) != SSA_NAME + || !SSA_NAME_RANGE_INFO (op0) + || !vect_get_range_info (op0, &op_min_value, + &op_max_value)) break; if (cvt_type == NULL_TREE |