From: Kiran Chandramohan Date: Tue, 21 Feb 2023 15:16:16 +0000 (+0000) Subject: [Flang][OpenMP] Use the ultimate symbol for allocatable check X-Git-Tag: upstream/17.0.6~16895 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=09ef2da6d0f460da70c37bec9107823faf480a84;p=platform%2Fupstream%2Fllvm.git [Flang][OpenMP] Use the ultimate symbol for allocatable check Reviewed By: peixin Differential Revision: https://reviews.llvm.org/D144383 --- diff --git a/flang/lib/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp index a39493b..e5bc9cd 100644 --- a/flang/lib/Evaluate/tools.cpp +++ b/flang/lib/Evaluate/tools.cpp @@ -1166,7 +1166,7 @@ bool IsAllocatableDesignator(const Expr &expr) { // Allocatable sub-objects are not themselves allocatable (9.5.3.1 NOTE 2). if (const semantics::Symbol * sym{UnwrapWholeSymbolOrComponentOrCoarrayRef(expr)}) { - return semantics::IsAllocatable(*sym); + return semantics::IsAllocatable(sym->GetUltimate()); } return false; } diff --git a/flang/test/Semantics/OpenMP/omp-private-is-pointer-check.f90 b/flang/test/Semantics/OpenMP/omp-private-is-pointer-allocatable-check.f90 similarity index 51% rename from flang/test/Semantics/OpenMP/omp-private-is-pointer-check.f90 rename to flang/test/Semantics/OpenMP/omp-private-is-pointer-allocatable-check.f90 index c2b7244..7b3915d 100644 --- a/flang/test/Semantics/OpenMP/omp-private-is-pointer-check.f90 +++ b/flang/test/Semantics/OpenMP/omp-private-is-pointer-allocatable-check.f90 @@ -3,8 +3,16 @@ subroutine s integer, pointer :: p integer, target :: t + real(4), allocatable :: arr !$omp parallel private(p) p=>t !$omp end parallel + + allocate(arr) + !$omp parallel private(arr) + if (.not. allocated(arr)) then + print *, 'not allocated' + endif + !$omp end parallel end subroutine