]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran's gfc_match_char: %S to match symbol with host_assoc
authorTobias Burnus <tobias@codesourcery.com>
Mon, 16 Oct 2023 16:12:42 +0000 (18:12 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Mon, 16 Oct 2023 16:12:42 +0000 (18:12 +0200)
gfc_match ("... %s ...", ...) matches a gfc_symbol but with
host_assoc = 0. This commit adds '%S' as variant which matches
with host_assoc = 1

gcc/fortran/ChangeLog:

* match.cc (gfc_match_char): Match with '%S' a symbol
with host_assoc = 1.

(cherry picked from commit 0607e93490058ec31b6ab57078c54771f139b870)

gcc/fortran/ChangeLog.omp
gcc/fortran/match.cc

index 62a33475ee5bd0805ed27d1e2669b5a259fff3aa..bae90d1e5c1f88ff3190d975416dd7403f199251 100644 (file)
@@ -1,3 +1,11 @@
+2023-10-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2023-06-20  Tobias Burnus  <tobias@codesourcery.com>
+
+       * match.cc (gfc_match_char): Match with '%S' a symbol
+       with host_assoc = 1.
+
 2023-09-19  Tobias Burnus  <tobias@codesourcery.com>
 
        Backported from master:
index 3db8e0f09691185c67520583fcc44dc17f9770c5..38a0efed8acc65722d4f71367d6996a8421030b8 100644 (file)
@@ -1084,7 +1084,8 @@ gfc_match_char (char c, bool gobble_ws)
 
    %%  Literal percent sign
    %e  Expression, pointer to a pointer is set
-   %s  Symbol, pointer to the symbol is set
+   %s  Symbol, pointer to the symbol is set (host_assoc = 0)
+   %S  Symbol, pointer to the symbol is set (host_assoc = 1)
    %n  Name, character buffer is set to name
    %t  Matches end of statement.
    %o  Matches an intrinsic operator, returned as an INTRINSIC enum.
@@ -1151,8 +1152,9 @@ loop:
          goto loop;
 
        case 's':
+       case 'S':
          vp = va_arg (argp, void **);
-         n = gfc_match_symbol ((gfc_symbol **) vp, 0);
+         n = gfc_match_symbol ((gfc_symbol **) vp, c == 'S');
          if (n != MATCH_YES)
            {
              m = n;