From: Richard Biener Date: Tue, 1 Oct 2024 09:22:17 +0000 (+0200) Subject: tree-optimization/116905 - ICE with bogus range ops X-Git-Tag: basepoints/gcc-16~5566 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60fa7f51c84f042af70a3feea14236c102d6a9c2;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/testsuite/gcc.dg/pr116905.c b/gcc/testsuite/gcc.dg/pr116905.c new file mode 100644 index 00000000000..0a2b96ac1c1 --- /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 540a9b73308..b880f050715 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