This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
cpp generates wrong #line directives
- To: gcc-bugs at gcc dot gnu dot org
- Subject: cpp generates wrong #line directives
- From: Bruno Haible <haible at ilog dot fr>
- Date: Fri, 1 Sep 2000 19:18:54 +0200 (CEST)
- Cc: Zack Weinberg <zack at wolery dot cumb dot org>
Hi,
When there are #line directives in a source C files, the #line
directives emitted by "gcc -E" from this source file can be very
different from the given ones. As a consequence, functions below that
point get very wrong debugging information, and gdb displays totally
useless line numbers.
The data for this testcase is in
http://clisp.cons.org/~haible/bug-cpp-20000901.tar.gz
or
ftp://clisp.cons.org/pub/lisp/clisp/snapshots/bug-cpp-20000901.tar.gz
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/2.95.2/specs
gcc version 2.95.2 19991024 (release)
$ gcc -E stream.c > stream.i
First look at stream.c line 10136. It contains a "#line 9811" statement,
such that the following "goto read_next_char;" should be remembered as
line 9818.
Now look at stream.i line 43508. It contains a "# 9851" statement,
thus pretending that the following "goto read_next_char;" were in line
9852. This is off by 33 lines.
Bruno