Found at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/141265154c2fcc71

Reinhold Bader thinks that at least the second program, using default
initializers, is valid. Oddly, the program works with the TYPE is not defined
locally but use-associated.

The first program of M. Restelli is presumably wrong as it uses variables which
are implicitly declared as SAVE. - But one should re-check.


ifort v11.1, NAG f95 v5.1, pathscale 3.3b all accept all programs, g95 and
gfortran reject "one" and "two (B)".


!------ Program one ----------
module mod_xyz
 implicit none
contains
 pure subroutine psub()
  type ilist
    type(ilist), pointer :: next => null()
    integer :: i
  end type ilist
 end subroutine psub
end module mod_xyz
!------------------

!---------- Program two (A) ----------
module mod_xyz
 implicit none
 type ilist
   type(ilist), pointer :: next => null()
   integer :: i
 end type ilist
contains
 pure subroutine psub()
  type(ilist) :: var ! ACCEPTED
 end subroutine psub
end module mod_xyz

!---------- Program two (B) ----------
module mod_xyz2
 implicit none
contains
 pure subroutine psub()
  type ilist
    type(ilist), pointer :: next => null()
    integer :: i
  end type ilist
  type(ilist) :: var ! REJECTED
 end subroutine psub
end module mod_xyz2
!---------------------------------


-- 
           Summary: Wrongly rejected derived types with default initializers
                    in PURE procedures
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42008

Reply via email to