[PATCH] PR debug/43325
Dodji Seketeli
dodji@redhat.com
Wed Mar 31 20:20:00 GMT 2010
On Wed, Mar 31, 2010 at 01:10:49PM -0400, Jason Merrill wrote:
> On 03/31/2010 05:44 AM, Dodji Seketeli wrote:
> >+ DIE for it again. Allow re-declarations of DECLs that are
> >+ inside functions, though. */
> >+ if (old_die&& declaration&& !local_scope_p (context_die))
> > return;
>
> How about just checking that context_die is different from
> old_die->die_parent?
That was my first thought too. But it appeared that it breaks at least
the test gcc/testsuite/g++.dg/debug/dwarf2/static-data-member2.C
from PR http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26965
which is basically:
enum x { i = 1 };
class c {
static const x beg = i;
int foo () { return (int) beg; }
};
We don't want to emit a DW_TAG_variable for beg because it is not used.
But here is what happens:
When emitting the debug info for class c[1] gen_variable_die fires and
we emit DW_TAG_member for beg.
Then at the end of compilation cp_write_global_declarations fires
gen_variable_die again for the global definition of beg and as there was
a die (DW_TAG_member) previously emitted in the context of class c,
using the condition you mentioned would make us emit the DW_TAG_variable
for beg.
[1] Just to make things clear, the debug info for class c is emitted but
pruned at the end of the whole process, so it's not present in the
output.
Dodji
More information about the Gcc-patches
mailing list