[Bug fortran/78942] Incorrect error message for preprocessed source

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 9 20:25:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78942

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |53993

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Bálint Aradi from comment #0)
> This bug may be also related to bug 78792.

gfortran diagnostics now rely on the common diagnostics machinery to tack line
numbers and print back the source code. The common machinery works on logical
lines, which are defined by the linemarkers:
https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html

So when you do 'gfortran test.f90', the logical location of 'program F,AIL' is
defined by the linemarker # 1 "test.F90", however, gfortran ignores the
"test.F90" (bug 53993) so it tries to open physical line 1 in test.f90, which
is the wrong location.


> Actually, the issue can be cured by changing the first line marker to
> indicate an include file, as running gfortran on the modified preprocessed
> source below gives the correct error message again:

That is wrong, because test.F90 is not an include file, and likely to cause
other problems.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53993
[Bug 53993] gfortran ignores file part of #line directives for debugging


More information about the Gcc-bugs mailing list