diff mbox series

tree-optimization/116905 - ICE with bogus range ops

Message ID 20241001094727.DA5F2386D609@sourceware.org
State New
Headers show
Series tree-optimization/116905 - ICE with bogus range ops | expand

Commit Message

Richard Biener Oct. 1, 2024, 9:47 a.m. UTC
The following avoids querying ranges of vector entities.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

	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.
---
 gcc/testsuite/gcc.dg/pr116905.c | 14 ++++++++++++++
 gcc/tree-vect-stmts.cc          |  6 ++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/pr116905.c
diff mbox series

Patch

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 c0f8351d3de..e1e4f762078 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -14805,8 +14805,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