This is the mail archive of the
mailing list for the GCC project.
- From: Paul Brook <paul at codesourcery dot com>
- To: Canqun Yang <canqun at nudt dot edu dot cn>,Richard Henderson <rth at twiddle dot net>, gcc-patches at gcc dot gnu dot org,fortran at gcc dot gnu dot org
- Date: Sat, 7 Feb 2004 13:46:26 +0000
- Subject: Re: forall_3.f90
- Organization: CodeSourcery
- References: <20040207075220.9BF9C5B46D@ds20.nudt.edu.cn>
On Saturday 07 February 2004 7:52 am, Canqun Yang wrote:
> I have tested the patch both on IA32 and IA64 Liunx. On
> IA32, all testcase passed, but on IA64, specifics.f90
> still can not be passed.
> Below is the wrong code segment extracted from
> The while loop does not get the proper element number
> (num.63) for the
> temporary due to the inner_size (T.62) evaluated too
You analysis of the problem is correct, however your solution is not.
An expression may only be used after its pre-code has been executed, and
before its post-code has been executed. The pre- and post- trees may also
depend on the index variable. Hence you need to move the whole calculation
inside the inner loop, not just the resulting expression.
Consider the following case:
! Not complete/self contained, but sufficient to generate tree dumps.
integer :: s
integer, dimension(:), pointer :: p
character(5) :: q
type (t), dimension (5) :: v
character(len=5) :: d
character(len=*) :: c
v(i)%p(1:len_trim(v(i)%q // c)) = v(6-i)%p(1:len_trim(v(6-i)%q // c))
Note that this exposes annother (unrelated) bug. The temporary used in the
call to len_trim is never freed. I suspect this is a bug in the loop
scalarizer when loop->array_parameter = 1, and is not specific to forall
statements. The same bug can be seen in the following code:
call foo(v(1)%p(1:len_trim(v(i)%q // c)))