[Bug fortran/41869] New: ICE segfault when reading module file

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Oct 29 15:16:00 GMT 2009


The following program ICEs with
  test.f90:25:0: internal compiler error: Segmentation fault

The problem is related to PUBIC vs. PRIVATE visibility. It is no regression as
4.1.2, 4.2.1, 4.3.3, 4.4.1 and 4.5 crash. The program compiles with NAG f95 and
g95.

Valgrind shows:
==31812== Invalid read of size 8
==31812==    at 0x4F4B80: mio_pointer_ref (module.c:2233)
==31812==    by 0x6D05D0F: ???
==31812==    by 0x4F6698: mio_symbol_ref (module.c:2494)
==31812==    by 0x4F7137: mio_expr (module.c:3029)

gdb shows:
Program received signal SIGSEGV, Segmentation fault.
mio_pointer_ref (gp=0x28) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/module.c:2233
2233          p = get_pointer (*((char **) gp));
(gdb) bt
#0  mio_pointer_ref (gp=0x28) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/module.c:2233
#1  0x00000000004f6699 in mio_symbol_ref (symp=<value optimized out>) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/module.c:2494
#2  0x00000000004f7138 in mio_expr (ep=0x13a96c0) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/module.c:3029
#3  0x00000000004f7a7a in mio_array_spec (asp=<value optimized out>) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/module.c:2134
#4  0x00000000004f7d07 in mio_symbol (sym=0x13a7930) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/module.c:3540
#5  0x00000000004f81d0 in write_symbol (n=40, sym=0x13a7930) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/module.c:4725
#6  0x00000000004f8360 in write_symbol0 (st=<value optimized out>) at
/home/tob/projects/gcc-trunk-checkout/gcc/fortran/module.c:4765



module fox_m_fsys_array_str
contains
  pure function str_vs(vs) result(s)
    character, dimension(:), intent(in) :: vs
    character(len=size(vs)) :: s
    s = transfer(vs, s)
  end function str_vs
  pure function vs_str(s) result(vs)
    character(len=*), intent(in) :: s
    character, dimension(len(s)) :: vs
    vs = transfer(s, vs)
  end function vs_str
end module fox_m_fsys_array_str
module fox_m_fsys_format
  private
  interface str
    module procedure  str_logical_array
  end interface str
  interface len
    module procedure str_logical_array_len
  end interface
  public :: str
contains
  pure function str_logical_array_len(la) result(n)
    logical, dimension(:), intent(in)   :: la
  end function str_logical_array_len
  pure function str_logical_array(la) result(s)
    logical, dimension(:), intent(in)   :: la
    character(len=len(la)) :: s
  end function str_logical_array
  pure function checkFmt(fmt) result(good)
    character(len=*), intent(in) :: fmt
    logical :: good
    good = len(fmt) > 0
  end function checkFmt
end module fox_m_fsys_format
module m_dom_dom
  use fox_m_fsys_array_str, only: str_vs, vs_str
end module m_dom_dom
module FoX_dom
  use fox_m_fsys_format
  use m_dom_dom
end module FoX_dom


-- 
           Summary: ICE segfault when reading module file
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          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=41869



More information about the Gcc-bugs mailing list