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
|