View previous topic :: View next topic |
Author |
Message |
JohnMansell
Joined: 10 May 2006 Posts: 18 Location: Darlington
|
Posted: Thu Apr 17, 2008 11:51 am Post subject: ftn95 5.20.1 -zero size array of derived type |
|
|
in ftn95 5.20.1, the third call with zero-size array of derived type appears as length 1 in the subroutine body. I really want size to tell me 0. This feature works for simple variables.
module testmod
type boxp
integer p
character(1) c
end type
contains
subroutine testsub(p)
type(boxp),intent(in) :: p(
integer l
l = size(p)
print *,l
end subroutine
end module
program main
use testmod
type(boxp) :: x(2)=(/boxp(1,'#'),boxp(5,'#')/)
call testsub(x)
call testsub(x(1:1))
call testsub(x(1:0)) ! this is the problem call
end program |
|
Back to top |
|
|
JohnMansell
Joined: 10 May 2006 Posts: 18 Location: Darlington
|
Posted: Thu Apr 17, 2008 11:57 am Post subject: |
|
|
FWIW, the problem is present with ftn95 5.10, so not a regression. |
|
Back to top |
|
|
JohnMansell
Joined: 10 May 2006 Posts: 18 Location: Darlington
|
Posted: Thu Apr 17, 2008 12:16 pm Post subject: |
|
|
Also, this call provides the expected result
call testsub((/(boxp(0,'*'),i=1,0)/))
as does this
type(boxp) z(1:0)
call testsub(z)
So I have a work around |
|
Back to top |
|
|
|