c++/7721: Very simple (but incorrect) template chokes g++

Pop Sébastian pop@gauvain.u-strasbg.fr
Tue Oct 8 15:30:00 GMT 2002


On Sun, Sep 29, 2002 at 04:36:45PM +0200, Gabriel Dos Reis wrote:
> Pop Sébastian <pop@gauvain.u-strasbg.fr> writes:
> 
> [...]
> 
> | Maybe we could give a better diagnostic for this error...
> | Gaby, can you help to fix this error?
> 
> Yes, actually there are several instances of this ICE in tthe GNATS --
> sorry I can't tell you off hand which ones (but I know there are more
> than two :-).  I should submit a patch this week -- I've been gotten
> busy by more pressing things.
> 
Seems like PR#7721 and PR#7803 are the same bug ...

More explicitly G++ dies on the same statement

	switch (TREE_CODE (decl))
	{
	[...]

          default:
=>          my_friendly_assert (0, 20020917);

decl is on both PRs a template_decl:


for PR#7721
(gdb) p debug_tree (decl)
 <template_decl 0x401ae000 CallStrategy
    type <record_type 0x401aae70 CallStrategy<ForwardingPolicy> type_5 VOID
        align 8 symtab 0 alias set -1
        n_parents 0 use_template=0 interface-unknown
        pointer_to_this <pointer_type 0x401aaee0> chain <type_decl 0x401aaf50 CallStrategy<ForwardingPolicy>>>
    VOID file pr7721.ii line 2
    align 1
    arguments <tree_list 0x40199f00
        purpose <integer_cst 0x40171b80 constant 1>
        value <tree_vec 0x40199eec type <template_decl 0x401ae000 CallStrategy>

            elt 0 <tree_list 0x40199ed8>>>
    result <type_decl 0x401aaf50 CallStrategy<ForwardingPolicy> type <record_type 0x401aae70 CallStrategy<ForwardingPolicy>>
        decl_2 VOID file pr7721.ii line 2
        align 1
        chain <type_decl 0x401aae00 ForwardingPolicy type <template_type_parm 0x401aad90 ForwardingPolicy>
            decl_0 VOID file pr7721.ii line 1
            align 1>>
    chain <function_decl 0x4019c3f0 __cxa_call_unexpected>>
$2 = void
(gdb)



for PR#7803
(gdb) p debug_tree (decl)
 <template_decl 0x4037ca10 allocator
    type <record_type 0x4037c8c0 allocator<_Alloc> type_1 type_2 type_5 VOID
        size <integer_cst 0x40171ce0 constant 0>
        align 8 symtab 0 alias set -1
        fields <template_decl 0x4061c8c0 rebind type <record_type 0x4061c770 rebind<_Tp1>>
            ignored in_system_header VOID file ../usr/include/c++/3.3/bits/stl_alloc.h line 657
            align 1 context <record_type 0x4037c8c0 allocator<_Alloc>>
            arguments <tree_list 0x40619e38
                purpose <integer_cst 0x40171de0 constant 2>
                value <tree_vec 0x40619e24 type <template_decl 0x4061c8c0 rebind>

                    elt 0 <tree_list 0x40619e10>>
                chain <tree_list 0x40619820
                    purpose <integer_cst 0x40171b80 constant 1>
                    value <tree_vec 0x4061980c
                        elt 0 <tree_list 0x406197f8>>>> result <type_decl 0x4061c850 rebind<_Tp1>>
            chain <type_decl 0x4061ac40 allocator>> context <namespace_decl 0x40174c40 std>
        ~X() X() X(constX&) n_parents 0 use_template=0 interface-unknown
        member-functions <tree_vec 0x4061b680
            elt 0 <overload 0x40529780>
            elt 1 <function_decl 0x40620930 allocator>
            elt 2 <function_decl 0x40621380 allocate>
            elt 3 <function_decl 0x40621690 deallocate>
            elt 4 <overload 0x405297a0>
            elt 5 <function_decl 0x40621930 max_size>
            elt 6 <function_decl 0x40621d20 construct>
            elt 7 <function_decl 0x40623000 destroy>>
        pointer_to_this <pointer_type 0x4037c930> chain <type_decl 0x4037c9a0 allocator<_Alloc>>>
    in_system_header VOID file ../usr/include/c++/3.3/bits/stringfwd.h line 57
    align 1 context <namespace_decl 0x40174c40 std>
    arguments <tree_list 0x4037d348 purpose <integer_cst 0x40171b80 1>
        value <tree_vec 0x4037d334 type <template_decl 0x4037ca10 allocator>

            elt 0 <tree_list 0x4037d320>>>
    result <type_decl 0x4037c9a0 allocator<_Alloc> type <record_type 0x4037c8c0 allocator<_Alloc>>
        in_system_header decl_2 VOID file ../usr/include/c++/3.3/bits/stl_alloc.h line 644
        align 1 context <namespace_decl 0x40174c40 std>
        chain <type_decl 0x4037c850 _Alloc type <template_type_parm 0x4037c7e0 _Alloc>
            in_system_header decl_0 VOID file ../usr/include/c++/3.3/bits/stringfwd.h line 56
            align 1>>
    chain <template_decl 0x4037c4d0 char_traits>>
$3 = void
(gdb)



More information about the Gcc-bugs mailing list