[Bug fortran/58182] New: ICE with global binding name used as a FUNCTION

abensonca at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 17 16:35:00 GMT 2013


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

            Bug ID: 58182
           Summary: ICE with global binding name used as a FUNCTION
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abensonca at gmail dot com

The following leads to an ICE with gfortran 4.9.0 (r201758):

$ cat mod1.F90
module fg
  use, intrinsic :: iso_c_binding
contains
  function fffi(f)
    interface
       function f() bind(c)
       end function f
    end interface
  end function fffi
end module fg

$ cat mod2.F90
module f
  use fg
end module f

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/Galacticus/Tools/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/abenson/Galacticus/Tools
--enable-languages=c,c++,fortran --disable-multilib
--with-gmp=/home/abenson/Galacticus/Tools
Thread model: posix
gcc version 4.9.0 20130815 (experimental) (GCC) 

$ gfortran -c mod1.F90 -o mod1.o
$ gfortran -c mod2.F90 -o mod2.o
f951: internal compiler error: Segmentation fault
0x95dcbf crash_signal
        ../../gcc-trunk/gcc/toplev.c:335
0x556f38 gfc_verify_binding_labels
        ../../gcc-trunk/gcc/fortran/resolve.c:10117
0x579e23 do_traverse_symtree
        ../../gcc-trunk/gcc/fortran/symbol.c:3571
0x565df3 resolve_types
        ../../gcc-trunk/gcc/fortran/resolve.c:14422
0x561a80 gfc_resolve
        ../../gcc-trunk/gcc/fortran/resolve.c:14489
0x563774 gfc_resolve
        ../../gcc-trunk/gcc/fortran/resolve.c:14482
0x563774 resolve_symbol
        ../../gcc-trunk/gcc/fortran/resolve.c:13257
0x579e23 do_traverse_symtree
        ../../gcc-trunk/gcc/fortran/symbol.c:3571
0x565bd2 resolve_types
        ../../gcc-trunk/gcc/fortran/resolve.c:14392
0x561a80 gfc_resolve
        ../../gcc-trunk/gcc/fortran/resolve.c:14489
0x54e6ef gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:4645
0x58a9f5 gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.c:189
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.

The "BIND(C)" seems to be necessary for the ICE to happen.

Also, if I place both modules in the same file the ICE does not happen and a
suitable error message is reported:

$ cat mod1.F90 mod2.F90 > mod12.F90
$ gfortran -c mod12.F90 -o mod12.o
mod12.F90:11.8:

module f
        1
mod12.F90:6.7:

       function f() bind(c)
       2
Error: Global binding name 'f' at (1) is already being used as a FUNCTION at
(2)



More information about the Gcc-bugs mailing list