[PATCH] PR fortran/56520 -- Special case unary minus/plus

Steve Kargl sgk@troutmask.apl.washington.edu
Wed Jul 1 17:53:00 GMT 2015


The attached patch special cases unary minus/plus when
gfotran tries to match a function keyword in a mangled
statement.  The testcase contains examples, but for
context consider 'c = exp(-a) )' where the final ')'
is erronous.  gfortran is trying to match a keyword
such as 'c = exp(x=-a)' so it expects the character
after the '(' to be in [a-z] or '_'.  Prior to this
patch, gfortran would do

% gfc -c sd.f90
sd.f90:8:13:

     c = exp(-a) )    ! dg-error { "Unclassifiable statement" }
             1
Error: Invalid character in name at (1)

with the patch gfortran will instead issue

% gfc -c sd.f90
sd.f90:8:4:

     c = exp(-a) )    ! dg-error { "Unclassifiable statement" }
    1
Error: Unclassifiable statement at (1)

It can be debated that the new error message isn't much better
than old.  I don't care to enter into such a debate, so will 
ignore comments complaining the new meesage isn't much of an
improvement over the old.

Regression tested on trunk.  Ok to commit?

2015-07-01  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/56520
	* match.c (gfc_match_name): Special case unary minus and plus.

2015-07-01  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/56520
	* gfortran.dg/pr56520.f90: New test.

-- 
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr56520.diff
Type: text/x-diff
Size: 1406 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150701/e16e7883/attachment.bin>


More information about the Fortran mailing list