Commit e565e49f by Tobias Burnus Committed by Tobias Burnus

Improve is-coindexed check for OpenACC/OpenMP

        gcc/fortran/
        * openmp.c (resolve_omp_clauses): Move is-coindexed check from here ...
        (gfc_match_omp_variable_list): ... to here.

        gcc/testsuite/
        * gfortran.dg/goacc/coindexed-1.f90: New.

From-SVN: r279637
parent 74a7b87a
2019-12-20 Tobias Burnus <tobias@codesourcery.com>
* openmp.c (resolve_omp_clauses): Move is-coindexed check from here ...
(gfc_match_omp_variable_list): ... to here.
2019-12-19 Julian Brown <julian@codesourcery.com>
* openmp.c (resolve_oacc_data_clauses): Don't disallow allocatable
......
......@@ -274,6 +274,11 @@ gfc_match_omp_variable_list (const char *str, gfc_omp_namelist **list,
default:
break;
}
if (gfc_is_coindexed (expr))
{
gfc_error ("List item shall not be coindexed at %C");
goto cleanup;
}
}
gfc_set_sym_referenced (sym);
p = gfc_get_omp_namelist ();
......@@ -4544,9 +4549,6 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
gfc_error ("%qs in %s clause at %L is not a proper "
"array section", n->sym->name, name,
&n->where);
else if (gfc_is_coindexed (n->expr))
gfc_error ("Entry shall not be coindexed in %s "
"clause at %L", name, &n->where);
else
{
int i;
......
2019-12-20 Tobias Burnus <tobias@codesourcery.com>
* gfortran.dg/goacc/coindexed-1.f90: New.
2019-12-20 Tobias Burnus <tobias@codesourcery.com>
* gfortran.dg/goacc/data-clauses.f95: Remove now
obsolete dg-error.
......
! { dg-do compile }
! { dg-additional-options "-fcoarray=single" }
!
subroutine check_coindexed()
implicit none
type t
integer :: i
end type t
type t2
integer, allocatable :: i[:]
type(t), allocatable :: x[:]
end type t2
type(t), allocatable :: A(:)[:], B(:)[:]
type(t) :: D(1)[*], E[*]
type(t2) :: C
save :: D, E
! Coarrays are fine if they are local/not coindexed:
!$acc enter data copyin(D(1)%i)
!$acc enter data copyin(A(1))
!$acc enter data copyin(B(1)%i)
!$acc enter data copyin(C%i)
!$acc enter data copyin(C%x%i)
!$acc enter data copyin(C%i)
!$acc enter data copyin(C%x%i)
! Does not like the '[' after the identifier:
!$acc enter data copyin(E[2]) ! { dg-error "Syntax error in OpenMP variable list" }
!$acc enter data copyin(D(1)[2]%i) ! { dg-error "List item shall not be coindexed" }
!$acc enter data copyin(A(1)[4]) ! { dg-error "List item shall not be coindexed" }
!$acc enter data copyin(B(1)[4]%i) ! { dg-error "List item shall not be coindexed" }
!$acc enter data copyin(C%i[2]) ! { dg-error "List item shall not be coindexed" }
!$acc enter data copyin(C%x[4]%i) ! { dg-error "List item shall not be coindexed" }
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment