Skip to content

Commit

Permalink
tree-optimization/116905 - ICE with bogus range ops
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rguenth authored and Richard Biener committed Oct 1, 2024
1 parent 3e1bd64 commit 60fa7f5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions gcc/testsuite/gcc.dg/pr116905.c
Original file line number Diff line number Diff line change
@@ -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);
}
6 changes: 4 additions & 2 deletions gcc/tree-vect-stmts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 60fa7f5

Please sign in to comment.