llvm-project/flang/test/Semantics/OpenMP/assumed-size-array.f90
Krzysztof Parzyszek 8fcbd06b25
[flang][OpenMP] Avoid analyzing assumed-size array bases (#150324)
A check for character substrings masquerading as array sections was
using expression analyzer on the array base. When this array happened to
be an assumed-size array, the analyzer emitted a semantic error that did
not correspond to any issue with the source code.

To avoid that, check whether the object is an assumed-size array before
using the expression analyzer on it.

While at it, replace the call to GetShape with a simple check for rank,
since that's the only information needed.

Fixes https://github.com/llvm/llvm-project/issues/150297
2025-07-24 07:27:00 -05:00

26 lines
697 B
Fortran

!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
! This should compile without errors. Check for a symptom of a reasonable
! output.
!CHECK: omp.task depend
subroutine omp_task_depend_reproducer(work, myid, shift)
implicit none
integer, intent(in) :: myid, shift
real, intent(inout) :: work(*)
!$omp parallel shared(work, myid, shift)
!$omp single
!$omp task depend(in:work(myid+shift-1)) depend(in:work(myid-1)) depend(out:work(myid))
call dummy_kernel(work(myid))
!$omp end task
!$omp end single
!$omp end parallel
contains
subroutine dummy_kernel(x)
real :: x
x = x + 1.0
end subroutine dummy_kernel
end subroutine omp_task_depend_reproducer