aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-07-29 12:36:07 +0200
committerTobias Burnus <tobias@codesourcery.com>2022-07-29 12:36:07 +0200
commita6afbe5e9528e9ec3f0426d9791bd28e6e584d82 (patch)
tree311d37453278d7c8cf766d156113b4cc3d2084ca
parent49ba4fdeb648c149fa7d964ba812084262c3d06f (diff)
downloadgcc-a6afbe5e9528e9ec3f0426d9791bd28e6e584d82.zip
gcc-a6afbe5e9528e9ec3f0426d9791bd28e6e584d82.tar.gz
gcc-a6afbe5e9528e9ec3f0426d9791bd28e6e584d82.tar.bz2
OpenMP/Fortran: Permit assumed-size arrays in uniform clause
gcc/fortran/ChangeLog: * openmp.cc (resolve_omp_clauses): Permit assumed-size arrays in uniform clause. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/declare-simd-3.f90: New test.
-rw-r--r--gcc/fortran/openmp.cc3
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f9030
2 files changed, 32 insertions, 1 deletions
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index df9cdf4..a7eb6c3 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -7386,7 +7386,8 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
|| code->op == EXEC_OACC_PARALLEL
|| code->op == EXEC_OACC_SERIAL))
check_array_not_assumed (n->sym, n->where, name);
- else if (n->sym->as && n->sym->as->type == AS_ASSUMED_SIZE)
+ else if (list != OMP_LIST_UNIFORM
+ && n->sym->as && n->sym->as->type == AS_ASSUMED_SIZE)
gfc_error ("Assumed size array %qs in %s clause at %L",
n->sym->name, name, &n->where);
if (n->sym->attr.in_namelist && !is_reduction)
diff --git a/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90 b/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90
new file mode 100644
index 0000000..b94587ef
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/declare-simd-3.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+
+module m
+ implicit none (type, external)
+contains
+ real function add(x, y, j) result(res)
+ !$omp declare simd(add) uniform(x, y) linear(j : 1) simdlen(4)
+ integer, value :: j
+ real, intent(in) :: x(*), y(*)
+ res = x(j) + y(j)
+ end function
+end module m
+
+program main
+ use m
+ implicit none (type, external)
+ real, allocatable :: A(:), B(:), C(:)
+ integer :: i, N
+ N = 128
+ A = [(3*i, i = 1, N)]
+ B = [(7*i, i = 1, N)]
+ allocate (C(N))
+
+ !$omp simd
+ do i = 1, N
+ C(i) = add(A, B, i)
+ end do
+
+ if (any (C /= [(10*i, i = 1, N)])) error stop
+end program main