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.
This commit is contained in:
Tobias Burnus 2021-04-28 22:35:06 +02:00
parent c99f374713
commit e4aefface2
2 changed files with 14 additions and 0 deletions

View 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 () == '%'))
{

View File

@ -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