This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] integer(kind=init_expression) function is rejected
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 12 Jan 2008 00:32:47 -0800
- Subject: [patch, fortran] integer(kind=init_expression) function is rejected
Hi,
This one is embarrassingly simple. It took me many hours of combing through
gfc_match_expr to convince myself that it was handling the surrounding parens in
integer((int_t)) or integer(kind=(int_t)) correctly.
The problem is that seeing a '(' at the beginning of a name is not an error. It
is a MATCH_NO. So we were giving the error when trying to match "(int_t)" as a
name. By allowing this to return as MATCH_NO we eventually get to match_primary
which handles the beginning and ending parenthesis just fine.
Regression tested on x86-64. I will commit under the "obvious after a long
while and simple rule" :)
Jerry
2008-01-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/34722
* match.c (gfc_match_name): Don't error if leading character is a '(',
just return MATCH_NO.
Index: match.c
===================================================================
--- match.c (revision 131485)
+++ match.c (working copy)
@@ -496,7 +496,7 @@ gfc_match_name (char *buffer)
c = gfc_next_char ();
if (!(ISALPHA (c) || (c == '_' && gfc_option.flag_allow_leading_underscore)))
{
- if (gfc_error_flag_test() == 0)
+ if (gfc_error_flag_test() == 0 && c != '(')
gfc_error ("Invalid character in name at %C");
gfc_current_locus = old_loc;
return MATCH_NO;