[Patch, fortran] PR fortran/53732
Mikael Morin
mikael.morin@sfr.fr
Tue Jul 3 19:57:00 GMT 2012
Hello,
Revision 180898:
http://gcc.gnu.org/viewcvs?view=revision&revision=180898
introduced at the end of gfc_add_loop_ss_code some self recursive calls
to handle reductions' loops (like in sum for example).
However, as gfc_add_loop_ss_code already calls itself to handle scalar
and vector subscripts, the new calls had to be disabled if there was
such a subscript, as in that case the reduction(s) would have been
handled from within the subscript call.
Back then, I didn't pay attention, however, to the fact that the
subscript flag was set to true in all the subscript calls, so the
reductions are then handled with subscript set to true, which introduces
an unwanted conversion to gfc_array_index_type and the failure leading
to the PR.
The patch below (which is the one posted on bugzilla) disables reduction
handling if subscript is true, so that the reductions are handled from
the outer call instead of from the subscript call.
I have finally convinced myself that it is always right, as if there is
a reduction in a subscript, gfc_add_loop_ss_code will call
gfc_conv_expr_descriptor which will create a temporary, and the
reduction will be handled separatedly in a new loop initializing the
temporary.
Regression tested on x86_64-unknown-freebsd9.0.
OK for trunk/4.7?
Mikael
-------------- next part --------------
2012-07-15 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/53732
* trans-array.c (gfc_add_loop_ss_code): Disable self recursive calls
handling nested loop(s) if the subscript flag is true.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr53732_v1.patch
Type: text/x-patch
Size: 1271 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120703/ed5ff13d/attachment.bin>
-------------- next part --------------
2012-07-03 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/53732
* gfortran.dg/inline_sum_4.f90: New test.
-------------- next part --------------
! { dg-do compile }
!
! PR fortran/53732
! this was leading to an internal "mismatching comparison operand types" error
!
! Contributed by minzastro <minzastro@googlemail.com>
program test
implicit none
real*8 arr(4, 4, 4, 4)
arr(:,:,:,:) = 1d0
arr(1, :, :, = sum(arr, dim=1, mask=(arr(:,:,:,:) > 0d0))
end program test
More information about the Gcc-patches
mailing list