]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/116905 - ICE with bogus range ops
authorRichard Biener <rguenther@suse.de>
Tue, 1 Oct 2024 09:22:17 +0000 (11:22 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 1 Oct 2024 10:52:21 +0000 (12:52 +0200)
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.

gcc/testsuite/gcc.dg/pr116905.c [new file with mode: 0644]
gcc/tree-vect-stmts.cc

diff --git a/gcc/testsuite/gcc.dg/pr116905.c b/gcc/testsuite/gcc.dg/pr116905.c
new file mode 100644 (file)
index 0000000..0a2b96a
--- /dev/null
@@ -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);
+}
index 540a9b73308181e21e5ed23a418988b0fff8a6ce..b880f05071583661169a562fbe3db0e983f6bc28 100644 (file)
@@ -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