[Bug fortran/68218] New: ALLOCATE with size given by a module function
ysheofue at imgof dot com
gcc-bugzilla@gcc.gnu.org
Thu Nov 5 07:20:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68218
Bug ID: 68218
Summary: ALLOCATE with size given by a module function
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: ysheofue at imgof dot com
Target Milestone: ---
Calling ALLOCATE with an array size that is given by a function argument
results in multiple calls of this function.
This issue is present (at least) on gfortran versions 4.7 ... 5
The following program unintentionally calls "nquery()" four times:
MODULE mo_test
CONTAINS
FUNCTION nquery()
INTEGER :: nquery
WRITE (0,*) "hello!"
nquery = 1
END FUNCTION nquery
END MODULE mo_test
! ----------------------------------------------------------------------
! MAIN PROGRAM
! ----------------------------------------------------------------------
PROGRAM example
USE mo_test
INTEGER, ALLOCATABLE :: query_buf(:)
ALLOCATE(query_buf(nquery()))
END PROGRAM example
More information about the Gcc-bugs
mailing list