[Patch, Fortran] Fix error locations

Daniel Kraft d@domob.eu
Sun Dec 14 18:03:00 GMT 2008


Hi Mikael,

> The problem is with markers for errors which are one character left of
> what they should be. It is especially problematic on procedure arguments
> when the marker is under the comma, so that one cannot know which
> argument is wrong.
> 
> The problem was that in show_locus character counting started at 1 while
> the position counter was the difference between the character address at
> fault and that of the first one of the line. Thus, the first character
> should be counted as 0, not 1. This is the error.c of the patch
> 
> While I was testing the above, I noticed that the markers were not much
> better placed when there were spaces. This is the primary.c part of the
> patch.

thanks for the patch!  This is something I also stumbled across multiple 
times (of course), but never felt inclined to do something about it :D.

@@ -361,7 +353,7 @@ show_locus (locus *loc, int c1, int c2)
    c1 -= offset;
    c2 -= offset;

-  for (i = 1; i <= cmax; i++)
+  for (i = 0; i <= cmax; i++)
      {
        if (i == c1)
  	error_char ('1');

Now the loop does one more iteration, but I guess this is ok from 
looking quickly at the code as because of your other changes now simply 
the value 0 is possible for c1/c2, while before it would have been 
changed to 1.

Ok if no regression failures.

Yours,
Daniel

-- 
Done:  Arc-Bar-Cav-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran



More information about the Fortran mailing list