aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.cc
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2022-07-28 22:07:02 +0200
committerHarald Anlauf <anlauf@gmx.de>2022-07-31 20:43:17 +0200
commitd325e7048c85e13f12ea79aebf9623eddc7ffcaf (patch)
tree26f8ad6d7eab9e87f0feaa4767e672969e0b10f5 /gcc/fortran/primary.cc
parent0110cfd5449bae3a772f45ea2e4c5dab5b7a8ccd (diff)
downloadgcc-d325e7048c85e13f12ea79aebf9623eddc7ffcaf.zip
gcc-d325e7048c85e13f12ea79aebf9623eddc7ffcaf.tar.gz
gcc-d325e7048c85e13f12ea79aebf9623eddc7ffcaf.tar.bz2
Fortran: detect blanks within literal constants in free-form mode [PR92805]
gcc/fortran/ChangeLog: PR fortran/92805 * match.cc (gfc_match_small_literal_int): Make gobbling of leading whitespace optional. (gfc_match_name): Likewise. (gfc_match_char): Likewise. * match.h (gfc_match_small_literal_int): Adjust prototype. (gfc_match_name): Likewise. (gfc_match_char): Likewise. * primary.cc (match_kind_param): Match small literal int or name without gobbling whitespace. (get_kind): Do not skip over blanks. (match_string_constant): Likewise. gcc/testsuite/ChangeLog: PR fortran/92805 * gfortran.dg/literal_constants.f: New test. * gfortran.dg/literal_constants.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
Diffstat (limited to 'gcc/fortran/primary.cc')
-rw-r--r--gcc/fortran/primary.cc14
1 files changed, 3 insertions, 11 deletions
diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc
index 3f01f67..19f2e78 100644
--- a/gcc/fortran/primary.cc
+++ b/gcc/fortran/primary.cc
@@ -45,11 +45,11 @@ match_kind_param (int *kind, int *is_iso_c)
*is_iso_c = 0;
- m = gfc_match_small_literal_int (kind, NULL);
+ m = gfc_match_small_literal_int (kind, NULL, false);
if (m != MATCH_NO)
return m;
- m = gfc_match_name (name);
+ m = gfc_match_name (name, false);
if (m != MATCH_YES)
return m;
@@ -95,7 +95,7 @@ get_kind (int *is_iso_c)
*is_iso_c = 0;
- if (gfc_match_char ('_') != MATCH_YES)
+ if (gfc_match_char ('_', false) != MATCH_YES)
return -2;
m = match_kind_param (&kind, is_iso_c);
@@ -1074,17 +1074,9 @@ match_string_constant (gfc_expr **result)
c = gfc_next_char ();
}
- if (c == ' ')
- {
- gfc_gobble_whitespace ();
- c = gfc_next_char ();
- }
-
if (c != '_')
goto no_match;
- gfc_gobble_whitespace ();
-
c = gfc_next_char ();
if (c != '\'' && c != '"')
goto no_match;