------- Comment #2 from rguenth at gcc dot gnu dot org 2010-04-21 13:08 ------- Wade-through-the-code dump:
gfc_trans_assignment_1 gets make_esss:esss(:) (+ make_esss:esss(:) _gfortran_sum_r8[[(((* make_esss:ix(: , __convert_i4_i8[[((make_esss:e_x(FULL)))]]) make_esss:iyz(: , __convert_i4_i8[[((make_esss:ii_ivec(FULL)))]]))) (_8) ((arg not-present)))]]) the first issue is that while we can properly scalarize subroutine test0(esss,Ix,Iyz) real(kind=kind(1.0d0)), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:) :: Ix,Iyz esss = sum(Ix * Iyz, 0) end subroutine we can't handle subroutine test1(esss,Ix,Iyz) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:,:) :: Ix,Iyz esss = sum(Ix * Iyz, 0) end subroutine as gfc_conv_intrinsic_function does not handle expr->rank > 0 for inline expansion. The second issue is that for subroutine test0(esss,Ix,Iyz, e_x, ii_ivec) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:) :: Ix,Iyz integer(kind=kind(1)), dimension(:) :: e_x,ii_ivec esss = Ix(e_x) * Iyz(ii_ivec) end subroutine we create temporaries for e_x and ii_ivec. Even for subroutine test0(esss,Ix, e_x) real(kind=kind(1.0d0)), dimension(:), intent(out) :: esss real(kind=kind(1.0d0)), dimension(:) :: Ix integer(kind=kind(1)), dimension(:) :: e_x esss = Ix(e_x) end subroutine -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Scalarization of reductions |Scalarization of reductions |with Fortran array | |expressions | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43829