This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] assumed-rank some bound intrinsics support, fix failures and improve diagnostcs
- From: Tobias Burnus <burnus at net-b dot de>
- To: Mikael Morin <mikael dot morin at sfr dot fr>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Wed, 01 Aug 2012 12:00:58 +0200
- Subject: Re: [Patch, Fortran] assumed-rank some bound intrinsics support, fix failures and improve diagnostcs
- References: <500930BC.1060801@net-b.de> <500A86BF.1060805@sfr.fr> <500A8DB8.4040904@net-b.de> <501159F1.5060704@sfr.fr> <50115E62.3060200@sfr.fr> <50116303.7070105@net-b.de> <5012CF5F.4040606@sfr.fr>
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.]