Gfortran, g95 and ifort all compile and run it but Sun Fortran 95
8.6 Linux_i386 2011/11/16 complains at run time that
CALL lbc_backend( field, SIZE(field,1), 1, src=src )
is an attempt to use a missing optional dummy. I note that field
is of rank 1 inside lbc_masspooint but rank 2 inside lbc_backend.
On Wed, 23 Jul 2014, Bill Long wrote:
> Date: Wed, 23 Jul 2014 17:30:38 +0000
> From: Bill Long <[log in to unmask]>
> Reply-To: Fortran 90 List <[log in to unmask]>
> To: [log in to unmask]
> Subject: Re: Explicitly shaped optional array argument
>
> This should work. I filed a bug. In the mean time, does the problem go away if compiled with -Oipa0 ? (Disable inlining.)
>
> Cheers,
> Bill
>
> On Jul 23, 2014, at 11:47 AM, Oliver Fuhrer (MeteoSwiss) <[log in to unmask]> wrote:
>
>> Dear all,
>>
>> I have a code which runs on PGI and GNU but segfaults on the Cray compiler which uses an explicitly shaped optional array argument.
>>
>> MODULE test
>>
>> CONTAINS
>>
>> SUBROUTINE lbc_masspoint(field, src )
>> IMPLICIT NONE
>> REAL , INTENT(INOUT) :: field(:)
>> REAL , INTENT(IN), OPTIONAL :: src(:)
>> CALL lbc_backend( field, SIZE(field,1), 1, src=src )
>> END SUBROUTINE lbc_masspoint
>>
>> SUBROUTINE lbc_backend(field, id, kd, src )
>> IMPLICIT NONE
>> INTEGER, INTENT(IN) :: id, kd
>> REAL , INTENT(INOUT) :: field(id,kd)
>> REAL , INTENT(IN), OPTIONAL :: src(id,kd)
>> END SUBROUTINE lbc_backend
>>
>> END MODULE test
>>
>> PROGRAM bug1
>> USE test
>> IMPLICIT NONE
>> REAL :: fexp(45)
>> CALL lbc_masspoint( fexp(:) )
>> END PROGRAM bug1
>>
>> The problem is with the src field, which is actually not present but causes the executable to segfault. I am supposing that it’s legal to do this (I have searched Metcalf et al., but have not found anything to the contrary), but wanted to double check.
>>
>> Kind regards,
>> Oli
>>
>>
>> _________________________________________________
>> Oliver Fuhrer
>> Numerical Models
>>
>> Federal Department of Home Affairs FDHA
>> Federal Office of Meteorology and Climatology MeteoSwiss
>> We have moved and have new phone numbers:
>> Operation Center 1
>> Postfach 257
>> 8058 Zürich-Flughafen
>> T. +41 58 460 93 59
>> M. +41 79 548 65 84
>> F. +41 58 460 96 66
>> [log in to unmask]
>> http://www.meteoswiss.admin.ch/
>
> Bill Long [log in to unmask]
> Fortran Technical Suport & voice: 651-605-9024
> Bioinformatics Software Development fax: 651-605-9142
> Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101
>
>
-- John Harper, School of Mathematics Statistics and Operations Research
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail [log in to unmask] phone (+64)(4)463 5276 fax (+64)(4)463 5045
|