aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/check-allocate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Semantics/check-allocate.cpp')
-rw-r--r--flang/lib/Semantics/check-allocate.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/flang/lib/Semantics/check-allocate.cpp b/flang/lib/Semantics/check-allocate.cpp
index a7244e1..b4c5660 100644
--- a/flang/lib/Semantics/check-allocate.cpp
+++ b/flang/lib/Semantics/check-allocate.cpp
@@ -611,6 +611,20 @@ bool AllocationCheckerHelper::RunChecks(SemanticsContext &context) {
return false;
}
}
+ if (allocateInfo_.gotPinned) {
+ std::optional<common::CUDADataAttr> cudaAttr{GetCUDADataAttr(ultimate_)};
+ if (!cudaAttr || *cudaAttr != common::CUDADataAttr::Pinned) {
+ context.Say(name_.source,
+ "Object in ALLOCATE must have PINNED attribute when PINNED option is specified"_err_en_US);
+ }
+ }
+ if (allocateInfo_.gotStream) {
+ std::optional<common::CUDADataAttr> cudaAttr{GetCUDADataAttr(ultimate_)};
+ if (!cudaAttr || *cudaAttr != common::CUDADataAttr::Device) {
+ context.Say(name_.source,
+ "Object in ALLOCATE must have DEVICE attribute when STREAM option is specified"_err_en_US);
+ }
+ }
return RunCoarrayRelatedChecks(context);
}