------- Comment #3 from drow at gcc dot gnu dot org  2006-07-23 16:44 -------
Subject: Re:  [4.0/4.1/4.2 Regression] g++ emits bogus namespace DIE

On Sun, Jul 23, 2006 at 03:59:58PM -0000, mark at codesourcery dot com wrote:
> If we're setting TYPE_CONTEXT to global_namespace, I think that's a C++
> front end bug.  Which type is getting set up like that?

I was wrong; TYPE_CONTEXT looks OK.  How about for DECLs?

Compile "int var;" with cc1plus -g, and set a breakpoint on
gen_namespace_die.  Up a couple of frames, you'll see:

#6  0x00000000008599ad in gen_decl_die (decl=0x2aaaab17b370,
context_die=0x2aaaab176ea0)
    at /space/fsf/commit/gcc/gcc/dwarf2out.c:13117
13117         declare_in_namespace (decl, context_die);

(gdb) call debug_tree (decl)
 <var_decl 0x2aaaab17b370 var
    type <integer_type 0x2aaaab0014d0 int asm_written public SI
        size <integer_cst 0x2aaaaafeeba0 constant invariant 32>
        unit size <integer_cst 0x2aaaaafee6c0 constant invariant 4>
        align 32 symtab 0 alias set -1 precision 32 min <integer_cst
0x2aaaaafeeb10 -2147483648> max <integer_cst 0x2aaaaafeeb40 2147483647>
        pointer_to_this <pointer_type 0x2aaaab013790>>
    asm_written public static tree_1 SI file /space/fsf/namespace.cc line 1
size <integer_cst 0x2aaaaafeeba0 32> unit size <integer_cst 0x2aaaaafee6c0 4>
    align 32 context <namespace_decl 0x2aaaab00f000 ::>
    (mem/c/i:SI (symbol_ref:DI ("var") [flags 0x2] <var_decl 0x2aaaab17b370
var>) [0 var+0 S4 A32]) chain <function_decl 0x2aaaab118d20
__cxa_call_unexpected>>

(gdb) call debug_tree (decl.decl_minimal.context)
 <namespace_decl 0x2aaaab00f000 :: public VOID file <built-in> line 0
    align 1
   >

So, the variable is in the global namespace explicitly.


-- 


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

Reply via email to