Question about source file location when one uses #line 1 "example2.in" directive
Martin Liška
mliska@suse.cz
Wed Apr 19 14:18:00 GMT 2017
On 04/19/2017 10:31 AM, Thomas Koenig wrote:
> Hello Martin,
>
>>> I've been working on
>>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78792, where one provides
>>> #line directive. Problem is that in ipa-profile.c I see:
>>>
>>> $ cat ~/Programming/testcases/pr78792.f90
>>> #line 10 "example.in"
>>> PROGRAM example
>>> PRINT *, "example"
>>> END PROGRAM
>
> The place to start work on this would probably in scanner.c,
> gfc_define_undef_line, which handles lines starting out with #.
> I don't see anything there handling #line directives, so this looks
> like an obvious place to start.
>
> HTH
>
> Thomas
>
The place only handles #define and #undefine. Looks there's no place where '#line'
prefix is parsed. To be honest, I'm not able to compile a pre-processed Fortran file:
$ gfortran example2.f90 --coverage -cpp -E > example.f
$ cat example.f
# 1 "example2.f90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "example2.f90"
# 1 "example2.in" 1
# 1 "inc" 1
# 2 "example2.in" 2
PROGRAM example2
PRINT *, "example2"
END PROGRAM
# 2 "example2.f90" 2
$ gfortran example.f --coverage
example2.in:6:1:
PROGRAM example2
1
Error: Non-numeric character in statement label at (1)
example2.in:6:1:
..
Same with adding '-fpreprocessed' option when added.
Thanks,
Martin
More information about the Fortran
mailing list