[Patch, Fortran] Fix error locations

Mikael Morin mikael.morin@tele2.fr
Sun Dec 14 17:19:00 GMT 2008


Hello,

this should probably be classified as obvious, but as it is neither a
regression, nor a wrong-code, I'm submitting it for approval.


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.



I suspect there are many more cases where markers are still not
correctly placed but if I don't see them, they don't exist :p.

There is no case for the test suite as there is no change in the error
messages, accepted/rejected code, etc.

Ok to commit this (I'm regression-testing at the moment) ?

Mikael



2008-12-14  Mikael Morin  <mikael.morin@tele2.fr>

	* error.c (show_locus): Start counting columns at 0.
	* primary.c (match_actual_arg): Eat spaces
	before copying the current locus.
	(match_variable): Copy the locus before matching.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: error_03.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20081214/612995c2/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.f90
Type: text/x-fortran
Size: 425 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20081214/612995c2/attachment.bin>


More information about the Fortran mailing list