diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2015-07-02 17:29:04 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2015-07-02 17:29:04 +0000 |
commit | 83eb71f4e4a081e25a5e953acfc8757c5f4e85fb (patch) | |
tree | c1ce8d641c402a7a9ef7ff2f282e02c7943f8a26 /gcc/fortran/match.c | |
parent | 70db5f0228d943a1deb37e0210ce6bbc0ac913c6 (diff) | |
download | gcc-83eb71f4e4a081e25a5e953acfc8757c5f4e85fb.zip gcc-83eb71f4e4a081e25a5e953acfc8757c5f4e85fb.tar.gz gcc-83eb71f4e4a081e25a5e953acfc8757c5f4e85fb.tar.bz2 |
re PR fortran/56520 (Syntax error causes misleading message: "Invalid character in name")
2015-07-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/56520
* match.c (gfc_match_name): Special case unary minus and plus.
2015-07-02 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/56520
* gfortran.dg/pr56520.f90: New test.
From-SVN: r225349
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r-- | gcc/fortran/match.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index e7fe831..c66addb 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -537,7 +537,10 @@ gfc_match_name (char *buffer) c = gfc_next_ascii_char (); if (!(ISALPHA (c) || (c == '_' && flag_allow_leading_underscore))) { - if (!gfc_error_flag_test () && c != '(') + /* Special cases for unary minus and plus, which allows for a sensible + error message for code of the form 'c = exp(-a*b) )' where an + extra ')' appears at the end of statement. */ + if (!gfc_error_flag_test () && c != '(' && c != '-' && c != '+') gfc_error ("Invalid character in name at %C"); gfc_current_locus = old_loc; return MATCH_NO; |