]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran/OpenMP: Fix var-list expr parsing with array/dt
authorTobias Burnus <tobias@codesourcery.com>
Wed, 28 Apr 2021 20:35:06 +0000 (22:35 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Thu, 29 Apr 2021 06:46:37 +0000 (08:46 +0200)
gcc/fortran/ChangeLog:

* openmp.c (gfc_match_omp_variable_list): Gobble whitespace before
checking whether a '%' or parenthesis-open follows as next character.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/map-5.f90: New test.

(cherry picked from commit e4aefface2a0e34d84b85844b11652eb28f2cf0c)

gcc/fortran/openmp.c
gcc/testsuite/gfortran.dg/gomp/map-5.f90 [new file with mode: 0644]

index 1f1920cf0e12eec29dfc56f633514da9fc0f0e41..8e4527bfbc69330cc8a523f0e20d12bddf94318f 100644 (file)
@@ -261,6 +261,7 @@ gfc_match_omp_variable_list (const char *str, gfc_omp_namelist **list,
        case MATCH_YES:
          gfc_expr *expr;
          expr = NULL;
+         gfc_gobble_whitespace ();
          if ((allow_sections && gfc_peek_ascii_char () == '(')
              || (allow_derived && gfc_peek_ascii_char () == '%'))
            {
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-5.f90 b/gcc/testsuite/gfortran.dg/gomp/map-5.f90
new file mode 100644 (file)
index 0000000..2b4b341
--- /dev/null
@@ -0,0 +1,13 @@
+implicit none
+type t
+  integer :: b(5)
+end type t
+integer :: a(5), x, y(5)
+type(t) :: b
+!$omp target enter data map( to: a (:) )
+!$omp target enter data map( to: b % b )
+!$omp target enter data map( to: a(:) )
+!$omp target depend(out: y (2)) nowait
+!$omp end target
+
+end