This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/53993] gfortran ignores file part of #line directives for debugging


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]