On 07/27/2012 07:26 PM, Mikael Morin wrote:
do you have a test case exhibiting the problem? It seems fine to me.
Your second test case was too convoluted for me - and as I wasn't at
home, I couldn't test it. I now believe that your patch is okay; I will
later formally review it.
Do you intent to wrap it for final inclusion? I think it only lacks a
dejaGNUified test case and a changelog.
* * *
However, I found another spot where one needs to have a scalarizer;
possibly a poor man's version is enough. Namely INTENT(OUT) handling. Do
you have an idea how to best handle that case?
program test
implicit none
type t
integer, allocatable :: a
end type t
type(t) :: b(4,6)
integer :: i, j
do j = 1, 6
do i = 1, 4
allocate (b(i,j)%a)
end do
end do
call sub (b(::2,::3))
do j = 1, 6
do i = 1, 4
print *, i, j, allocated (b(i,j)%a)
! if (allocated (b(i,j)%a) .neqv. (mod (i-1,2) /= 0 .or. mod
(j-1,3) /= 0))&
! call abort ()
end do
end do
contains
subroutine sub (x)
type(t), intent(out) :: x(..)
end subroutine sub
end program test
Tobias
PS: Note to self: Reject passing an assumed-size array to an INTENT(OUT)
assumed-rank array, at least if it is "polymorphic, finalizable, of a
type with an allocatable ultimate component, or of a type for which
default initialization is specified." [TS29113 seems to allow it, but
one needs some check similar to F2008's C534. A constraint is not enough
as it doesn't cover all cases, but the rest is the user's responsibility.]