From: Tobias Burnus Date: Wed, 28 Apr 2021 20:35:06 +0000 (+0200) Subject: Fortran/OpenMP: Fix var-list expr parsing with array/dt X-Git-Tag: basepoints/gcc-13~8071 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4aefface2a0e34d84b85844b11652eb28f2cf0c;p=thirdparty%2Fgcc.git Fortran/OpenMP: Fix var-list expr parsing with array/dt 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. --- diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index a1b057227b76..7eeabff8e763 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -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 index 000000000000..2b4b341bc515 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/map-5.f90 @@ -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