[patch, fortran] PR34325 Wrong error message for syntax error

Jerry DeLisle jvdelisle@verizon.net
Fri Dec 14 17:22:00 GMT 2007


Seasons Greetings,

This patch adds a new function to check for missing parenthesis in a statement. 
  I tried to use this up front in decode_statement but it regresses several test 
cases that are finding the error by other means.

You have to be careful where you use this as well since some matchers get called 
several times.  So you will see in gfc_match_if where I use this that I put the 
check after the match for the IF has occurred.  This requires some back 
tracking, but it is fairly painless..

The patch just fixes this one bug in this one place in gfc_match_if.  The new 
function can be used selectively in other places as we discover them. 
(Especially after this email and people start looking for them :) )

I attempted to make sure we ignore quoted strings.  See the test case.

Regression tested on x86-64.

OK to commit?

Jerry

2007-12-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/34325
	* match.h: New function declaration.
	* match.c (gfc_match_parens): New function to look for mismatched
	parenthesis. (gfc_match_if): Use new function to catch missing '('.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr34325.diff
Type: text/x-patch
Size: 2814 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071214/dc43dd94/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: missing_parens_1.f90
Type: text/x-fortran
Size: 464 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071214/dc43dd94/attachment-0001.bin>


More information about the Gcc-patches mailing list