[Bug fortran/41937] New: Error in allocating derived type allocatable components
reuter at physik dot uni-freiburg dot de
gcc-bugzilla@gcc.gnu.org
Wed Nov 4 12:38:00 GMT 2009
When trying to compile the sample file, gfortran (I'm referring to the revision
r153847) chokes over allocating an allocatable array whose length depends on an
integer derived type in the same abstract type.
gfortran -c cuba_types_bug.f03
cuba_types_bug.f03:16.28:
allocate(this%integral(this%dim_f))
1
Error: 'this' must not appear in the array specification at (1) in the same
ALLOCATE statement where it is itself allocated
I think the code is OK according to the F2003 specification.
******
The test code is:
module cuba_types_module
implicit none
type, abstract :: cuba_abstract_type
private
integer :: dim_f = 1
real, dimension(:), allocatable :: integral
contains
procedure :: alloc_dim_f => cuba_abstract_alloc_dim_f
end type cuba_abstract_type
contains
subroutine cuba_abstract_alloc_dim_f(this)
class(cuba_abstract_type) :: this
allocate(this%integral(this%dim_f))
end subroutine cuba_abstract_alloc_dim_f
end module cuba_types_module
--
Summary: Error in allocating derived type allocatable components
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reuter at physik dot uni-freiburg dot de
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41937
More information about the Gcc-bugs
mailing list