Created attachment 30165 [details] Minimal test case The following invalid code (with a number instead of an identifier for the function argument) produces an internal error: > cat minimal.f90 interface foo function A(0) result(r) function A(0) result(r) end interface > > ~/sys/bin/gfortran minimal.f90 minimal.f90:2.15: function A(0) result(r) 1 Error: Expected formal argument list in function definition at (1) minimal.f90:3.14: function A(0) result(r) 1 Internal Error at (1): insert_bbt(): Duplicate key found! > ~/sys/bin/gfortran --version GNU Fortran (GCC) 4.9.0 20130517 (experimental) Copyright (C) 2013 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 > Here, ~/sys/bin/gfortran is self-compiled, however it happens already with verion 4.7.2 that is supplied with openSUSE 12.3.
Confirmed. Happens also with: interface foo function A(0) function A() end interface
0 0x45f20f60 in exit () from /lib/libc.so.6 #1 0x08161d73 in gfc_internal_error ( format=0x8b5da50 "insert_bbt(): Duplicate key found!") at ../../gcc/gcc/fortran/error.c:1101 #2 0x0813c644 in insert (new_bbt=new_bbt@entry=0x8f844d0, t=0x8f843f0, compare=compare@entry=0x81d5400 <compare_symtree(void*, void*)>) at ../../gcc/gcc/fortran/bbt.c:119 #3 0x0813c69c in gfc_insert_bbt (root=0x8fc3410, new_node=0x8f844d0, compare=0x81d5400 <compare_symtree(void*, void*)>) at ../../gcc/gcc/fortran/bbt.c:137 #4 0x081d80b1 in gfc_new_symtree (root=0x8fc3410, name=0xbfffe980 "a") at ../../gcc/gcc/fortran/symbol.c:2384 #5 0x081500bc in get_proc_name (name=name@entry=0xbfffe980 "a", result=result@entry=0xbfffe978, module_fcn_entry=module_fcn_entry@entry=false) at ../../gcc/gcc/fortran/decl.c:943 #6 0x081573db in gfc_match_function_decl () at ../../gcc/gcc/fortran/decl.c:5249 #7 0x081a4a81 in decode_statement () at ../../gcc/gcc/fortran/parse.c:312 #8 0x081a600c in next_free () at ../../gcc/gcc/fortran/parse.c:784 #9 next_statement () at ../../gcc/gcc/fortran/parse.c:977 #10 0x081a6a32 in parse_interface () at ../../gcc/gcc/fortran/parse.c:2384 Is the backtrace in case anyone is interested.
This PR is now fixed on trunk (7.0) and the gcc-5 and 6 branches by respectively r238822, 238848, and 238841. Closing as FIXED.