Bug 57373 - ICE on invalid: insert_bbt(): Duplicate key found!
Summary: ICE on invalid: insert_bbt(): Duplicate key found!
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.9.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2013-05-22 15:19 UTC by Lorenz Hüdepohl
Modified: 2016-08-05 13:10 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.3.4, 4.7.4, 4.8.0, 4.9.0
Last reconfirmed: 2013-05-28 00:00:00


Attachments
Minimal test case (57 bytes, text/x-fortran)
2013-05-22 15:19 UTC, Lorenz Hüdepohl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenz Hüdepohl 2013-05-22 15:19:20 UTC
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.
Comment 1 janus 2013-05-28 12:18:32 UTC
Confirmed. Happens also with:

interface foo
  function A(0)
  function A()
end interface
Comment 2 Bud Davis 2013-07-18 00:26:32 UTC
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.
Comment 3 Dominique d'Humieres 2016-08-05 13:10:38 UTC
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.