------- Comment #3 from jakub at gcc dot gnu dot org 2009-03-27 16:33 ------- Created an attachment (id=17544) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17544&action=view) gcc44-pr39563.patch
Untested fix. The problem with this patch is that DW_AT_decl_file and DW_AT_decl_line of the DW_AT_external DW_TAG_variable and DW_TAG_subprogram DIEs is wrong. Say for: extern void abort (void); int var = 1; int main (void) { int var = 2; if (var != 2) abort (); { extern int var; extern void abort (void); if (var != 1) abort (); { int var = 3; if (var != 3) abort (); { extern int var; extern void abort (void); if (var != 1) abort (); } } } return 0; } for all DW_AT_external DW_TAG_variable DIEs DW_AT_decl_line is 3 and for abort DW_AT_decl_line is the last extern void abort (void) line. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39563