ICE with current CVS and enable-checking ("Tree check: expected function_decl, have template_decl")

Andreas Jaeger aj@suse.de
Thu Dec 9 07:57:00 GMT 1999


With the current CVS version I get on an i686 running Linux 2.2.13
with glibc 2.1.2 the following ICE when configuring with
--enable-checking:

  /usr/src/build-cc/gcc/xgcc -B/usr/src/build-cc/gcc/ -B/opt/gcc-2.96/i686-pc-linux-gnu/bin/ -c -g -O2 -fvtable-thunks -D_GNU_SOURCE -fno-implicit-templates -I../../../cvs/gcc/libstdc++ -I../../../cvs/gcc/libstdc++/stl -I../libio -I../../../cvs/gcc/libstdc++/../libio -nostdinc++ -D_IO_MTSAFE_IO -fpic ../../../cvs/gcc/libstdc++/stdexcepti.cc -o pic/stdexcepti.o
In file included from ../../../cvs/gcc/libstdc++/stdexcepti.cc:8:
../../../cvs/gcc/libstdc++/stl/stl_alloc.h: In function `size_t __default_alloc_template<threads, inst>::_S_freelist_index (unsigned int) [with bool threads = true, int inst = 0]':
../../../cvs/gcc/libstdc++/stl/stl_alloc.h:436:   instantiated from `__default_alloc_template<threads, inst>::deallocate (void *, unsigned int) [with bool threads = true, int inst = 0]'
../../../cvs/gcc/libstdc++/std/bastring.cc:42:   instantiated from `basic_string<charT, traits, Allocator>::Rep::operator delete (void *) [with charT = char, traits = string_char_traits<char>, Allocator = __default_alloc_template<true, 0>]'
../../../cvs/gcc/libstdc++/std/bastring.h:109:   instantiated from `basic_string<charT, traits, Allocator>::Rep::release () [with charT = char, traits = string_char_traits<char>, Allocator = __default_alloc_template<true, 0>]'
../../../cvs/gcc/libstdc++/std/bastring.h:190:   instantiated from `basic_string<charT, traits, Allocator>::basic_string (int) [with charT = char, traits = string_char_traits<char>, Allocator = __default_alloc_template<true, 0>]'
../../../cvs/gcc/libstdc++/stdexcept:45:   instantiated from here
../../../cvs/gcc/libstdc++/stl/stl_alloc.h:347: Tree check: expected function_decl, have template_decl
../../../cvs/gcc/libstdc++/stl/stl_alloc.h:347: Internal compiler error in `lookup_arg_dependent', at ../cvs/gcc/gcc/cp/decl2.c:4825
Please submit a full bug report.
See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.
make[1]: *** [stdexcepti.o] Error 1
make[1]: Leaving directory `/usr/src/build-cc/i686-pc-linux-gnu/libstdc++'

Running cc1plus under gdb gives the following information:

(gdb) r stdexcepti.ii -quiet -dumpbase stdexcepti.cc -g -O2 -version
-fvtable-thunks -fno-implicit-templates -fpic -o stdexcepti.s
#0  fancy_abort (file=0x84b70e0 "../../../cvs/gcc/gcc/cp/decl2.c", line=4825, 
    function=0x84b8931 "lookup_arg_dependent") at ../../cvs/gcc/gcc/rtl.c:1253
#1  0x805aa88 in tree_class_check_failed (node=0x403b2080, cl=29, 
    file=0x84b70e0 "../../../cvs/gcc/gcc/cp/decl2.c", line=4825, 
    function=0x84b8931 "lookup_arg_dependent") at ../../cvs/gcc/gcc/tree.c:5189
#2  0x8400206 in lookup_arg_dependent (name=0x40018540, fns=0x4039cfa0, 
    args=0x40454e20) at ../../../cvs/gcc/gcc/cp/decl2.c:4825
#3  0x83b0a1c in lookup_function_nonclass (name=0x40018540, args=0x40454e20)
    at ../../../cvs/gcc/gcc/cp/decl.c:5693
#4  0x839e394 in build_new_op (code=PLUS_EXPR, flags=3, arg1=0x40450f00, 
    arg2=0x402aad00, arg3=0x0) at ../../../cvs/gcc/gcc/cp/call.c:3169
#5  0x8427006 in build_x_binary_op (code=PLUS_EXPR, arg1=0x40450f00, 
    arg2=0x402aad00) at ../../../cvs/gcc/gcc/cp/typeck.c:3244
#6  0x83fcfda in build_expr_from_tree (t=0x40454d80)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3806
#7  0x83fcfcc in build_expr_from_tree (t=0x40454da0)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3806
#8  0x83fcfcc in build_expr_from_tree (t=0x40454dc0)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3806
#9  0x83fcfcc in build_expr_from_tree (t=0x40454de0)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3806
#10 0x83dc7df in tsubst_expr (t=0x402382a0, args=0x402bba20, complain=1, 
    in_decl=0x402aee00) at ../../../cvs/gcc/gcc/cp/pt.c:7366
#11 0x83db2d9 in tsubst_expr (t=0x402382e0, args=0x402bba20, complain=1, 
    in_decl=0x402aee00) at ../../../cvs/gcc/gcc/cp/pt.c:7118
#12 0x83dbbc9 in tsubst_expr (t=0x402364a0, args=0x402bba20, complain=1, 
    in_decl=0x402aee00) at ../../../cvs/gcc/gcc/cp/pt.c:7236
#13 0x83e1adf in instantiate_decl (d=0x402da880)
    at ../../../cvs/gcc/gcc/cp/pt.c:9576
#14 0x8400ed7 in mark_used (decl=0x402da880)
    at ../../../cvs/gcc/gcc/cp/decl2.c:5177
#15 0x84243bf in build_component_ref (datum=0x40453880, component=0x402c5100, 
    basetype_path=0x402cca80, protect=1)
    at ../../../cvs/gcc/gcc/cp/typeck.c:2152
#16 0x8424a04 in build_x_component_ref (datum=0x40453880, 
    component=0x402c5100, basetype_path=0x0, protect=1)
    at ../../../cvs/gcc/gcc/cp/typeck.c:2278
#17 0x83fe11d in build_expr_from_tree (t=0x40452e80)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3972
#18 0x83fdcff in build_expr_from_tree (t=0x40452ea0)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3924
#19 0x83fcf80 in build_expr_from_tree (t=0x40453800)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3807
#20 0x83fd350 in build_expr_from_tree (t=0x40453840)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3838
#21 0x83dc7df in tsubst_expr (t=0x40273680, args=0x402b73a0, complain=1, 
    in_decl=0x402b6a80) at ../../../cvs/gcc/gcc/cp/pt.c:7366
#22 0x83db369 in tsubst_expr (t=0x402736e0, args=0x402b73a0, complain=1, 
    in_decl=0x402b6a80) at ../../../cvs/gcc/gcc/cp/pt.c:7124
#23 0x83dbbc9 in tsubst_expr (t=0x4026c260, args=0x402b73a0, complain=1, 
    in_decl=0x402b6a80) at ../../../cvs/gcc/gcc/cp/pt.c:7236
#24 0x83e1adf in instantiate_decl (d=0x402daf00)
    at ../../../cvs/gcc/gcc/cp/pt.c:9576
#25 0x8400ed7 in mark_used (decl=0x402daf00)
    at ../../../cvs/gcc/gcc/cp/decl2.c:5177
#26 0x83a07ee in build_over_call (cand=0x8614f6c, args=0x4044df60, flags=11)
    at ../../../cvs/gcc/gcc/cp/call.c:4117
#27 0x83a151b in build_new_method_call (instance=0x4044dfa0, name=0x402c54c0, 
    args=0x4044df60, basetype_path=0x402cca80, flags=11)
    at ../../../cvs/gcc/gcc/cp/call.c:4347
#28 0x839811f in build_method_call (instance=0x4044dfa0, name=0x402c54c0, 
    parms=0x4044df60, basetype_path=0x402cca80, flags=11)
    at ../../../cvs/gcc/gcc/cp/call.c:502
#29 0x843899a in build_member_call (type=0x402ce000, name=0x402c54c0, 
    parmlist=0x4044df60) at ../../../cvs/gcc/gcc/cp/init.c:1470
#30 0x83fdbb8 in build_expr_from_tree (t=0x4044dd60)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3904
#31 0x83dc7df in tsubst_expr (t=0x403c9000, args=0x40429c60, complain=1, 
    in_decl=0x40359b00) at ../../../cvs/gcc/gcc/cp/pt.c:7366
#32 0x83db369 in tsubst_expr (t=0x403c9020, args=0x40429c60, complain=1, 
    in_decl=0x40359b00) at ../../../cvs/gcc/gcc/cp/pt.c:7124
#33 0x83dbbc9 in tsubst_expr (t=0x403c8aa0, args=0x40429c60, complain=1, 
    in_decl=0x40359b00) at ../../../cvs/gcc/gcc/cp/pt.c:7236
#34 0x83e1adf in instantiate_decl (d=0x4042a300)
    at ../../../cvs/gcc/gcc/cp/pt.c:9576
#35 0x8400ed7 in mark_used (decl=0x4042a300)
    at ../../../cvs/gcc/gcc/cp/decl2.c:5177
#36 0x84265b0 in build_function_call_real (function=0x4042a300, 
    params=0x4044ade0, require_complete=1, flags=3)
    at ../../../cvs/gcc/gcc/cp/typeck.c:2941
#37 0x8426af3 in build_function_call (function=0x4042a300, params=0x4044ade0)
    at ../../../cvs/gcc/gcc/cp/typeck.c:3057
#38 0x839f096 in build_op_delete_call (code=142, addr=0x40447200, 
    size=0x4001d580, flags=3, placement=0x0)
    at ../../../cvs/gcc/gcc/cp/call.c:3564
#39 0x83f6e71 in delete_sanity (exp=0x40447200, size=0x0, doing_vec=0, 
    use_global_delete=0) at ../../../cvs/gcc/gcc/cp/decl2.c:1211
#40 0x83fd612 in build_expr_from_tree (t=0x4044ad20)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3853
#41 0x83dc7df in tsubst_expr (t=0x4035a820, args=0x40429720, complain=1, 
    in_decl=0x40359680) at ../../../cvs/gcc/gcc/cp/pt.c:7366
#42 0x83db369 in tsubst_expr (t=0x4035a840, args=0x40429720, complain=1, 
    in_decl=0x40359680) at ../../../cvs/gcc/gcc/cp/pt.c:7124
#43 0x83dbbc9 in tsubst_expr (t=0x4035a800, args=0x40429720, complain=1, 
    in_decl=0x40359680) at ../../../cvs/gcc/gcc/cp/pt.c:7236
#44 0x83dba89 in tsubst_expr (t=0x4035a700, args=0x40429720, complain=1, 
    in_decl=0x40359680) at ../../../cvs/gcc/gcc/cp/pt.c:7212
#45 0x83dbbc9 in tsubst_expr (t=0x4035a020, args=0x40429720, complain=1, 
    in_decl=0x40359680) at ../../../cvs/gcc/gcc/cp/pt.c:7236
#46 0x83e1adf in instantiate_decl (d=0x40426e80)
    at ../../../cvs/gcc/gcc/cp/pt.c:9576
#47 0x8400ed7 in mark_used (decl=0x40426e80)
    at ../../../cvs/gcc/gcc/cp/decl2.c:5177
#48 0x83a07ee in build_over_call (cand=0x8614f1c, args=0x40446c00, flags=3)
    at ../../../cvs/gcc/gcc/cp/call.c:4117
#49 0x83a151b in build_new_method_call (instance=0x40446ba0, name=0x4033ea80, 
    args=0x0, basetype_path=0x0, flags=3)
    at ../../../cvs/gcc/gcc/cp/call.c:4347
#50 0x839811f in build_method_call (instance=0x40446ba0, name=0x4033ea80, 
    parms=0x0, basetype_path=0x0, flags=3)
    at ../../../cvs/gcc/gcc/cp/call.c:502
#51 0x83fda39 in build_expr_from_tree (t=0x404469e0)
    at ../../../cvs/gcc/gcc/cp/decl2.c:3893
#52 0x83dc7df in tsubst_expr (t=0x403a5a20, args=0x403fc820, complain=1, 
    in_decl=0x40368300) at ../../../cvs/gcc/gcc/cp/pt.c:7366
#53 0x83db369 in tsubst_expr (t=0x403a5ae0, args=0x403fc820, complain=1, 
    in_decl=0x40368300) at ../../../cvs/gcc/gcc/cp/pt.c:7124
#54 0x83dbbc9 in tsubst_expr (t=0x403a6d40, args=0x403fc820, complain=1, 
    in_decl=0x40368300) at ../../../cvs/gcc/gcc/cp/pt.c:7236
#55 0x83e1adf in instantiate_decl (d=0x403fd180)
    at ../../../cvs/gcc/gcc/cp/pt.c:9576
#56 0x8400ed7 in mark_used (decl=0x403fd180)
    at ../../../cvs/gcc/gcc/cp/decl2.c:5177
#57 0x83a07ee in build_over_call (cand=0x8614ec4, args=0x404439c0, flags=520)
    at ../../../cvs/gcc/gcc/cp/call.c:4117
#58 0x83a151b in build_new_method_call (instance=0x40443960, name=0x4001b580, 
    args=0x40443980, basetype_path=0x0, flags=520)
    at ../../../cvs/gcc/gcc/cp/call.c:4347
#59 0x839811f in build_method_call (instance=0x40443960, name=0x4001b580, 
    parms=0x40443980, basetype_path=0x0, flags=520)
    at ../../../cvs/gcc/gcc/cp/call.c:502
#60 0x843c04f in build_delete (type=0x403f4400, addr=0x40443940, 
    auto_delete=0x4001d540, flags=520, use_global_delete=0)
    at ../../../cvs/gcc/gcc/cp/init.c:3056
#61 0x8436261 in perform_member_init (member=0x4041f580, name=0x403f2380, 
    init=0x40422640, explicit=1) at ../../../cvs/gcc/gcc/cp/init.c:233
#62 0x8436ead in emit_base_init (t=0x403f4480)
    at ../../../cvs/gcc/gcc/cp/init.c:597
#63 0x844e304 in setup_vtbl_ptr () at ../../../cvs/gcc/gcc/cp/semantics.c:1235
#64 0x8416c12 in yyparse () at parse.y:1588
#65 0x804b881 in compile_file (name=0xbffff929 "stdexcepti.ii")
    at ../../cvs/gcc/gcc/toplev.c:3238
#66 0x804f60b in main (argc=13, argv=0xbffff784)
    at ../../cvs/gcc/gcc/toplev.c:5611
(gdb) p debug_tree (fns)
 <overload 0x4039cfa0
    type <lang_type 0x40121400 unknown type type <lang_type 0x40121400 unknown type>
       
        permanent VOID
        size <integer_cst 0x4001d580 constant permanent 0>
        align 1 symtab 0 alias set -1
        pointer_to_this <lang_type 0x40121400 unknown type> reference_to_this <lang_type 0x40121400 unknown type>>
   
    permanent
    function <template_decl 0x403b2080 __pl
        type <function_type 0x403b1900 type <record_type 0x403a9680 basic_string<charT,traits,Allocator>>
           
            permanent DI
            size <integer_cst 0x40358740 constant permanent 64>
            align 32 symtab 0 alias set -1
            arg-types <tree_list 0x40358700
                permanent value <reference_type 0x403aa680>
                chain <tree_list 0x40358720
                    permanent value <template_type_parm 0x403b1c00 charT>
                    chain <tree_list 0x4001dfa0
                        unsigned permanent value <void_type 0x40119b80 void>>>>>
       
        permanent VOID file /cvs/gcc/libstdc++/std/bastring.h line 504
        align 1
        arguments <tree_list 0x403ac800
            permanent
            purpose <integer_cst 0x403ac7e0 constant permanent 0x100000000>
            value <tree_vec 0x403ac780 type <template_decl 0x403b2080 __pl>
               
                permanent
                elt 0 <tree_list 0x403ac2c0>
                elt 1 <tree_list 0x403ac5a0>
                elt 2 <tree_list 0x403ac720>>>
        result <function_decl 0x403b2000 __pl type <function_type 0x403b1900>
           
            permanent public static external inline transparent-union decl_5 QI file /cvs/gcc/libstdc++/std/bastring.h line 504
            frame_size 0 arguments <parm_decl 0x403b1f00 lhs> result <result_decl 0x403b2100> initial <error_mark 0x40017380>
            decl-main-variant 0x403b2000 template-info 0x40358800>
        decl-main-variant 0x403b2080
        chain <template_decl 0x403b1680 __pl type <function_type 0x403b1580>
           
            permanent VOID file /cvs/gcc/libstdc++/std/bastring.h line 495
            align 1
            arguments <tree_list 0x40358400
                permanent
                purpose <integer_cst 0x40358320 constant permanent 0x100000000>
                value <tree_vec 0x40358240 type <template_decl 0x403b1680 __pl>
                   
                    permanent
                    elt 0 <tree_list 0x4038eec0>
                    elt 1 <tree_list 0x4035de60>
                    elt 2 <tree_list 0x40358220>>> result <function_decl 0x403b1600 __pl>
            decl-main-variant 0x403b1680 chain <template_decl 0x403b0c00 __pl>>>
    chain <overload 0x4039cf30 type <lang_type 0x40121400 unknown type>
       
        permanent function <template_decl 0x403b1680 __pl>
        chain <overload 0x4039cec0 type <lang_type 0x40121400 unknown type>
           
            permanent function <template_decl 0x403b0c00 __pl>
            chain <overload 0x4039ce50 type <lang_type 0x40121400 unknown type>
               
                permanent function <template_decl 0x403b0180 __pl>
                chain <overload 0x4037f360 type <lang_type 0x40121400 unknown type>
                   
                    permanent function <template_decl 0x403ae680 __pl>
                    chain <overload 0x403387a0 type <lang_type 0x40121400 unknown type>
                       
                        permanent function <template_decl 0x40349d00 __pl>>>>>>>
$22 = void

(gdb) p debug_tree (name)
 <identifier_node 0x40018540 __pl
    permanent tree_2
    bindings <binding 0x401c8180
        permanent scope 0x4001c000
        value <overload 0x4039cfa0 type <lang_type 0x40121400 unknown type>
           
            permanent function <template_decl 0x403b2080 __pl>
            chain <overload 0x4039cf30 type <lang_type 0x40121400 unknown type>
               
                permanent function <template_decl 0x403b1680 __pl>
                chain <overload 0x4039cec0 type <lang_type 0x40121400 unknown type>
                   
                    permanent function <template_decl 0x403b0c00 __pl>
                    chain <overload 0x4039ce50 type <lang_type 0x40121400 unknown type>
                       
                        permanent function <template_decl 0x403b0180 __pl>
                        chain <overload 0x4037f360 type <lang_type 0x40121400 unknown type>
                           
                            permanent function <template_decl 0x403ae680 __pl> chain <overload 0x403387a0>>>>>>>>
$24 = void
(gdb) p debug_tree (args)
 <tree_list 0x40454e20
    permanent
    value <parm_decl 0x40450f00 __bytes
        type <integer_type 0x40133180 size_t
            unsigned permanent type_6 SI
            size <integer_cst 0x400198a0 constant permanent 32>
            align 32 symtab 30 alias set 9 precision 32
            min <integer_cst 0x40019860 constant permanent 0>
            max <integer_cst 0x40019880 constant permanent 4294967295>
            pointer_to_this <pointer_type 0x40192f00>>
       
        unsigned used permanent SI file /cvs/gcc/libstdc++/stl/stl_alloc.h line 346 size <integer_cst 0x400198a0 32>
        align 32 context <function_decl 0x402da880 _S_freelist_index> initial <integer_type 0x40133180 size_t>>
    chain <tree_list 0x40454e00
        permanent
        value <integer_cst 0x402aad00 constant permanent 8>>>
$25 = void


Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de


More information about the Gcc-bugs mailing list