[Bug fortran/59093] Segfault in gfc_trans_pointer_assignment

matthew.thompson at nasa dot gov gcc-bugzilla@gcc.gnu.org
Wed Mar 26 18:29:00 GMT 2014


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

--- Comment #5 from Matt Thompson <matthew.thompson at nasa dot gov> ---
An additional thought. You have a reduced test case which dies in Comment #3
(which fails for gfortran 4.9). However, you can make something similar which
succeeds:
****
program main

implicit none

type :: MAPL_LocStream
  type(MAPL_LocStreamType), pointer :: Ptr
end type

type MAPL_Tiling
   integer :: IM
end type

type MAPL_LocStreamType
   type(MAPL_Tiling), pointer  :: Tiling(:)
end type

contains

  subroutine MAPL_LocStreamGet (GRIDIM)
    type(MAPL_LocStream) :: LocStream
    integer, pointer     :: GRIDIM(:)

    integer, pointer     :: LP(:)

    LP => LocStream%Ptr%Tiling(:)%IM

  end subroutine

end program main
****

So, it's not that gfortran/gcc can't do the pointer, it's that it can't do it
to a pointer passed through the interface. Note that this still fails:

****
program main

implicit none

type :: MAPL_LocStream
  type(MAPL_LocStreamType), pointer :: Ptr
end type

type MAPL_Tiling
   integer :: IM
end type

type MAPL_LocStreamType
   type(MAPL_Tiling), pointer  :: Tiling(:)
end type

contains

  subroutine MAPL_LocStreamGet (GRIDIM)
    type(MAPL_LocStream) :: LocStream
    integer, pointer     :: GRIDIM(:)

    integer, pointer     :: LP(:)

    LP => LocStream%Ptr%Tiling(:)%IM
    GRIDIM => LP

  end subroutine

end program main
****
with:
$ gfortran --version
GNU Fortran (GCC) 4.9.0 20140105 (experimental)
Copyright (C) 2014 Free Software Foundation, Inc.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING

$ gfortran test.fix.F90
test.fix.F90: In function ‘mapl_locstreamget’:
test.fix.F90:26:0: internal compiler error: Segmentation fault
     GRIDIM => LP
 ^
0x50ff58 ???
    ../sysdeps/x86_64/elf/start.S:113
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


More information about the Gcc-bugs mailing list