[PATCH fortran/linemap] Add enough column hint to fit any possible offset

Tobias Burnus burnus@net-b.de
Wed Dec 3 23:25:00 GMT 2014


Manuel López-Ibáñez wrote:
> In any case, the current patch fixes these ICEs and I couldn't trigger
> new ones. Bootstrapped and regression tested.
> OK for Fortran?

OK. Thanks.

  * * *

BTW: The output of the code changes with the common diagnostic. For a 
different test case, I get (old)

-------------------------
  print *, "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr 
", "jgk
1
Warning: Nonconforming tab character at (1)
-------------------------

while the new code gives:

-------------------------

print *, "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr 
", "jgkg"
1
Warning: Nonconforming tab character at (1) [-Wtabs]
-------------------------

Namely, the previous code trims the output to show only the code around 
the error location while the common-diagnostics code shows the whole line.

(That's normally not observable as the lines are short. That makes the ^ 
or rather (1) look rather misplaced. On the other hand, if the error 
location is misplaced, it is actually better; e.g. if a comment is at 
the end like the long "! {dg-error ...}", the location might point at 
the end of the comment, which is rather misplaced. Still, only showing 
part of the line probably makes sense in general.)

Tobias

> gcc/fortran/ChangeLog:
>
> 2014-12-02  Manuel López-Ibáñez  <manu@gcc.gnu.org>
>
>      * scanner.c (gfc_next_char_literal): Use gfc_warning_now.
>      (load_file): Use the line length as the column hint for
>      linemap_line_start. Reserve a location for the highest column of
>      the line.
>
> gcc/testsuite/ChangeLog:
>
> 2014-12-02  Manuel López-Ibáñez  <manu@gcc.gnu.org>
>
>      * gfortran.dg/line_length_5.f90: New test.



More information about the Gcc-patches mailing list