This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[3.0 regression] File naming confusion
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Subject: [3.0 regression] File naming confusion
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Thu, 24 May 2001 07:59:55 +0100
- Cc: gcc-bugs at gcc dot gnu dot org
Many moons ago, Benjamin Kosnik wrote:-
> I keep dropping the ball WRT the line-numbering issue. Here's a
> small example:
Here's a *really easy* testcase. We MUST get this fixed for 3.0.
#line 500 "foo.c"
int
main ()
{
return 0;
}
Compile with -g, and run gdb. Put a breakpoint on main. Run to see
the problem.
Clearly, the problem is the #line (or #pragma GCC system_header).
I'm 99% certain the bug is in c-lex.c in the cb_file_change function.
It goes like this [unimportant bits skipped]:-
if (fc->reason == FC_ENTER)
{
[...]
push_srcloc (fc->to.filename, 1);
debug_start_source_file (fc->to.filename);
[...]
}
else if (fc->reason == FC_LEAVE)
{
[...]
pop_srcloc ();
debug_end_source_file (input_file_stack->line);
[...]
}
This handles the cases of FC_ENTER (which is when entering the main
file or a #included file), FC_LEAVE (when leaving a header). There is
one more case for which we do nothing special: FC_RENAME. This is
used for #line and the #pragma.
It is clear to me that debug_* and maybe *_srcloc are needed for
FC_RENAME, but I'm not sure what.
I'm going to try a few things now.
Neil.