File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -611,6 +611,13 @@ bool AllocationCheckerHelper::RunChecks(SemanticsContext &context) {
611
611
return false ;
612
612
}
613
613
}
614
+ if (allocateInfo_.gotPinned ) {
615
+ std::optional<common::CUDADataAttr> cudaAttr{GetCUDADataAttr (ultimate_)};
616
+ if (!cudaAttr || *cudaAttr != common::CUDADataAttr::Pinned) {
617
+ context.Say (name_.source ,
618
+ " Object in ALLOCATE must have PINNED attribute when PINNED option is specified" _err_en_US);
619
+ }
620
+ }
614
621
return RunCoarrayRelatedChecks (context);
615
622
}
616
623
Original file line number Diff line number Diff line change @@ -23,4 +23,12 @@ module m
23
23
!BECAUSE: 'ma' is a host-associated allocatable and is not definable in a device subprogram
24
24
deallocate(ma)
25
25
end subroutine
26
+
27
+ subroutine hostsub()
28
+ integer, allocatable, device :: ia(:)
29
+ logical :: plog
30
+
31
+ !ERROR: Object in ALLOCATE must have PINNED attribute when PINNED option is specified
32
+ allocate(ia(100), pinned = plog)
33
+ end subroutine
26
34
end module
You can’t perform that action at this time.
0 commit comments