diff --git a/gcc/testsuite/gfortran.dg/pr111891.f90 b/gcc/testsuite/gfortran.dg/pr111891.f90 new file mode 100644 index 0000000000000000000000000000000000000000..1167ed60f4cb78afd2e044f8d5eddcc4f1c6a0d3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr111891.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +! { dg-options "-O2" } +! { dg-additional-options "-mavx" { target avx } } + +!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64') + +PARAMETER (NX=3, G=1.4) +DIMENSION T(NX,NX), P(NX,NX) +INTEGER Apx +COMMON P, T + +DO i = 1, 3 + IF (i < 0.0 ) THEN + P(Apx,i) = i**G + T(Apx,i) = i**G + ELSE + P(Apx,i) = 0 + T(Apx,i) = 0 + ENDIF +ENDDO +END diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 8d9028654c938647727755b0705c751a61e44851..337b24c51f953667ad4146002052ce40f34b7529 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -4070,7 +4070,13 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, if (thisarginfo.dt == vect_constant_def || thisarginfo.dt == vect_external_def) { - gcc_assert (vec_stmt || thisarginfo.vectype == NULL_TREE); + /* With SLP we determine the vector type of constants/externals + at analysis time, handling conflicts via + vect_maybe_update_slp_op_vectype. At transform time + we have a vector type recorded for SLP. */ + gcc_assert (!vec_stmt + || !slp_node + || thisarginfo.vectype != NULL_TREE); if (!vec_stmt) thisarginfo.vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op),