This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: reorder bug in 3.0
- To: amacleod at cygnus dot com, dan at cgsoftware dot com
- Subject: Re: reorder bug in 3.0
- From: Andrew Macleod <amacleod at cygnus dot com>
- Date: Tue, 9 Oct 2001 13:07:06 -0700
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, rth at redhat dot com, schwab at suse dot de
>> > I'll keep looking at it, but if it means anything to anyone:
>> > the die looks like:
>> Where is the die getting added from?
>> Break on new_die for the die it's aborting on.
>> It shouldn't be placed on the limbo die list unless it has no
>> parent. And if it has no parent, it should be a die with an abstract
>> origin (otherwise, where would we attach the die?)
I've reduced the testcase to something more managable, attached to the end.
basically, its a nested function which is passed as a parameter to an
extern function.
dwarf2out_decl() is called from rest_of_compilation().
The comment in dwarf2out_decl says :
/* If we're a nested function, initially use a parent of NULL; if we're
a plain function, this will be fixed up in decls_for_scope. If
we're a method, it will be ignored, since we already have a DIE. */
if (decl_function_context (decl))
context_die = NULL;
and so a context_die of NULL is passed to gen_decl_die().
The decl for add_to_tablewc doesn't seem to match up with anything
that gen_decl_die() is looking for, so it calls gen_subprogram_die()
with the NULL context_die.
At the end of gen_subprogram_die(), we call
decls_for_scope (outer_scope, subr_die, 0);
outer_scope is a block :
<block 0x2000000000356a80 asm_written used
supercontext <function_decl 0x20000000007615e0 add_to_tablewc
type <function_type 0x2000000000761500 type <void_type 0x2000000000326f40 void>
.....
and when decls_for_scope() is called, it never processes the function
because it is not in the blocks list of BLOCK_VARS:
$22 = {common = {chain = 0x0, type = 0x0, aux = 0x0, code = BLOCK,
side_effects_flag = 0, constant_flag = 0, addressable_flag = 0,
volatile_flag = 0, readonly_flag = 0, unsigned_flag = 0,
asm_written_flag = 1, used_flag = 1, nothrow_flag = 0, static_flag = 0,
public_flag = 0, private_flag = 0, protected_flag = 0, bounded_flag = 0,
lang_flag_0 = 0, lang_flag_1 = 0, lang_flag_2 = 0, lang_flag_3 = 0,
lang_flag_4 = 0, lang_flag_5 = 0, lang_flag_6 = 0, dummy = 0},
handler_block_flag = 0, abstract_flag = 0, block_num = 0, vars = 0x0,
subblocks = 0x2000000000356a00, supercontext = 0x20000000007615e0,
abstract_origin = 0x0, fragment_origin = 0x0, fragment_chain = 0x0}
vars is null, so the loop in decls_for_scope()
for (decl = BLOCK_VARS (stmt);
decl != NULL; decl = TREE_CHAIN (decl))
{
which processes decls never actually sees, then we process subblocks,
and the subblock chain, and the only thing in the subblock chain is
<block 0x2000000000356a00 asm_written used
vars <var_decl 0x2000000000761a40 weigthidx
...
Out decl is the supercontext, and it never gets processed by decls_for_scope().
Now this is deeper in the bowels of dwarf2 than I've been... what is suppose
to happen here? I've tried fooling around with the stuff in decls_for_scope
to see if I can get the right thing to happen, but no luck
so far.. perhaps someone more familiar with this code should take a quick peek.
The reduced testcase ought to make that much easier...
compile with -O2 -g
Andrew
----------------------------------
struct obstack
{
char *next_free;
char *chunk_limit;
};
extern void _obstack_newchunk (struct obstack *, int);
static inline void
obstack_int32_grow (struct obstack *obstack, int data)
{
__extension__ (
{ struct obstack *__o = (obstack);
if (__o->next_free + sizeof (int) > __o->chunk_limit)
_obstack_newchunk (__o, sizeof (int));
*((int *)__o->next_free)++ = (data);
(void) 0; });
}
struct wchead_table
{
};
struct collidx_table
{
};
struct locale_collate_t
{
struct wchead_table wcheads;
};
void
collate_output ()
{
struct locale_collate_t *collate;
struct obstack indirectpool;
struct collidx_table tablewc;
obstack_int32_grow (&indirectpool, 0);
{
auto void add_to_tablewc (unsigned int ch);
void add_to_tablewc (unsigned int ch)
{
unsigned int weigthidx;
collidx_table_add (&tablewc, ch, weigthidx);
}
wchead_table_iterate (&collate->wcheads, add_to_tablewc);
}
}