[flang][cuda] Downgrade allocate pinned error to a warning (#121589)

To be in accordance with the reference compiler.
This commit is contained in:
Valentin Clement (バレンタイン クレメン) 2025-01-03 10:35:11 -08:00 committed by GitHub
parent a4e47586b9
commit 39a9073f9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -616,9 +616,11 @@ bool AllocationCheckerHelper::RunChecks(SemanticsContext &context) {
}
if (allocateInfo_.gotPinned) {
std::optional<common::CUDADataAttr> cudaAttr{GetCUDADataAttr(ultimate_)};
if (!cudaAttr || *cudaAttr != common::CUDADataAttr::Pinned) {
if ((!cudaAttr || *cudaAttr != common::CUDADataAttr::Pinned) &&
context.languageFeatures().ShouldWarn(
common::UsageWarning::CUDAUsage)) {
context.Say(name_.source,
"Object in ALLOCATE must have PINNED attribute when PINNED option is specified"_err_en_US);
"Object in ALLOCATE should have PINNED attribute when PINNED option is specified"_warn_en_US);
}
}
if (allocateInfo_.gotStream) {

View File

@ -28,7 +28,7 @@ module m
integer, allocatable, device :: ia(:)
logical :: plog
!ERROR: Object in ALLOCATE must have PINNED attribute when PINNED option is specified
!WARNING: Object in ALLOCATE should have PINNED attribute when PINNED option is specified
allocate(ia(100), pinned = plog)
end subroutine