This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Disallow checking for upper case characters in gfc_match


Hi,

while working on parsing of typebound-procedures I just spent some time puzzling over why

gfc_match (" PASS")

didn't do the obviously intended... Until I remembered that the scanner converts all characters (well, at least those checked for in gfc_match) to lower-case in gfc_next_char...

What do you think about the attached patch to add an additional "sanity check" to gfc_match resulting in an ICE if a literal character is upper-case? This is very simple, has not much potential to break anything and would have saved me some time if it were already there.

Ok to commit with an appropriate ChangeLog entry? Regression testing running on GNU/Linux-x86-32.

Daniel

--
Done:     Arc-Bar-Sam-Val-Wiz, Dwa-Elf-Gno-Hum-Orc, Law-Neu-Cha, Fem-Mal
Underway: Cav-Dwa-Law-Fem
To go:    Cav-Hea-Kni-Mon-Pri-Ran-Rog-Tou
Index: match.c
===================================================================
--- match.c	(revision 138086)
+++ match.c	(working copy)
@@ -1187,6 +1187,12 @@ loop:
 	}
 
     default:
+
+      /* gfc_next_ascii_char converts characters to lower-case, so we shouldn't
+	 expect an upper case character here!  */
+      if (TOLOWER (c) != c)
+	gfc_internal_error ("gfc_match(): Expecting upper case '%c'", c);
+
       if (c == gfc_next_ascii_char ())
 	goto loop;
       break;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]