This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/53993] gfortran ignores file part of #line directives for debugging
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 Jul 2012 12:37:52 +0000
- Subject: [Bug fortran/53993] gfortran ignores file part of #line directives for debugging
- Auto-submitted: auto-generated
- References: <bug-53993-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53993
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-07-17 12:37:52 UTC ---
Okay, I think I understand:
#include "myfile.f90"
gets translated (cpp) into
# 1 "myfile.f90" 1
... content of that file ...
# 8 "myfile.f90" 2
Where "1" is the first line of "file" and "8" is the line, in the main file,
after the #include.
However, '#line 1234 "file"' gets translated into a simple:
# 1234 "file"
And the scanner.c code seemingly doesn't handle the case of having no number
after the string.
The following feels a bit hackish, but it works. I think the function could do
with some more comments.
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1728,2 +1728,8 @@ preprocessor_line (gfc_char_t *c)
+ if (! *c)
+ {
+ flag[1] = true;
+ goto process;
+ }
+
for (;;)
@@ -1741,2 +1747,3 @@ preprocessor_line (gfc_char_t *c)
+process:
/* Convert the filename in wide characters into a filename in narrow