This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51639] New: Nested type pointer null initialisation fails
- From: "jonathan.hogg at stfc dot ac.uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Dec 2011 16:10:12 +0000
- Subject: [Bug fortran/51639] New: Nested type pointer null initialisation fails
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51639
Bug #: 51639
Summary: Nested type pointer null initialisation fails
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jonathan.hogg@stfc.ac.uk
The following code appears to produce a regression in 4.6:
program main
implicit none
type type1
integer, dimension(:), allocatable :: member
end type type1
type type2
type(type1), pointer :: t1ptr=>null()
end type type2
call test
contains
subroutine test
type(type2) :: t2
print *, "associated(t2%t1ptr) = ", associated(t2%t1ptr)
end subroutine test
end program
Produces the output
associated(t2%t1ptr) = T
but should produce the output
associated(t2%t1ptr) = F
Further valgrind shows that access is to an uninitialised pointer.
The code works as expected under 4.4.6 and 4.5.4.
To provoke the error it seems that the associated() check must occur within a
subroutine, and that type1 must have an allocatable component.
Thanks,
Jonathan.