This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] Fix error locations
- From: Daniel Kraft <d at domob dot eu>
- To: Mikael Morin <mikael dot morin at tele2 dot fr>
- Cc: correctifs gcc <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Sun, 14 Dec 2008 18:49:59 +0100
- Subject: Re: [Patch, Fortran] Fix error locations
- References: <49454B1E.902@tele2.fr>
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