This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/41129] New: unassociated pointers are reported as associated by associated function in types


The following code segment

program scr
  type S1
     real, dimension(:), pointer :: P           ! NLEV
     real, dimension(:), pointer :: t           ! NLEV
  end type S1

  type S0
     real, dimension(:), pointer :: P           ! NLEV
  end type S0

  type (S0) :: x0
  type (S1) :: x1
  write (*,*)  'x0%P', associated(x0%P)
  allocate(x0%P(20))
  write (*,*)  'x0%P', associated(x0%P)

  write (*,*)  'x1%P', associated(x1%P)
  allocate(x1%P(20))
  write (*,*)  'x1%P', associated(x1%P)

 if (associated(x11%P)) deallocate(x11%P)
end program scr

compiled under gfortran:

gfortran -o scr scr.f90 ; scr
 x0%P F
 x0%P T
 x1%P T
 x1%P T
*** glibc detected *** double free or corruption (out): 0x0000000000400bc0 ***
Abort

compiled using the absoft compiler
/opt/absoft/bin/f90 -o scr scr.f90 ; scr
 x0%P F
 x0%P T
 x1%P F
 x1%P T

The textbook "Fortran 90 programing,  Ellis et al" says that the absoft
compiler is producing the correct answer -- the gfortran is not.  Generally the
compiler is misinterpreting types containing multiple pointers. attempts to
deallocate a pointer returned as associated produces an error


-- 
           Summary: unassociated pointers are reported as associated by
                    associated function in types
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: evan dot fishbein at jpl dot nasa dot gov


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]