[patch, fortran] integer(kind=init_expression) function is rejected

Jerry DeLisle jvdelisle@verizon.net
Sat Jan 12 20:33:00 GMT 2008


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;



More information about the Fortran mailing list