https://sourceware.org/bugzilla/show_bug.cgi?id=26740
--- Comment #3 from Mark Wielaard <mark at klomp dot org> --- (In reply to H.J. Lu from comment #2) > (In reply to Mark Wielaard from comment #1) > > The issue is that some instructions are emitted (dwarf2_emit_insn is called) > > before the first .file <NUMBER> directive has been seen. This allocates x.s > > (the input file) as first file entry. Later when the actual .file 1 > > lbasename.c and .file 2 safe-ctype are seen the x.s entry is moved to entry > > 3. We don't record that we never actually use that entry and so we still > > emit it. > > Is this a GCC bug? Even if it is, assembler shouldn't generate bad debug > info. I don't think so. Although it might help if gcc emitted the .file 1 directive earlier. The debug info isn't really bad, but it does contain an unused file name which it really shouldn't. I am not yet sure how to fix that. In gas/dwarf2dbg.c you see that the file entry is moved when a .file NUM is seen and the file entry is auto_assigned. I wonder if we should just replace it instead of moving if dwarf2_any_loc_directive_seen is false (because then we know it has never been used). -- You are receiving this mail because: You are on the CC list for the bug.