diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp index dfc2ddbacf071..6f2503285013d 100644 --- a/flang/lib/Semantics/check-call.cpp +++ b/flang/lib/Semantics/check-call.cpp @@ -1033,6 +1033,13 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy, *actualDataAttr == common::CUDADataAttr::Managed)) { actualDataAttr = common::CUDADataAttr::Device; } + // For device procedures, treat actual arguments with VALUE attribute as + // device data + if (!actualDataAttr && actualLastSymbol && IsValue(*actualLastSymbol) && + (*procedure.cudaSubprogramAttrs == + common::CUDASubprogramAttrs::Device)) { + actualDataAttr = common::CUDADataAttr::Device; + } } if (dummyDataAttr == common::CUDADataAttr::Device && (dummyIsAssumedShape || dummyIsAssumedRank) && diff --git a/flang/test/Semantics/cuf21.cuf b/flang/test/Semantics/cuf21.cuf index b8b99a8d1d9be..077657c8a52d5 100644 --- a/flang/test/Semantics/cuf21.cuf +++ b/flang/test/Semantics/cuf21.cuf @@ -9,19 +9,22 @@ module mlocModule end interface maxlocUpdate contains - attributes(global) subroutine maxlocPartialMaskR_32F1D() + attributes(global) subroutine maxlocPartialMaskR_32F1D(back) implicit none + logical, intent(in), value :: back real(4) :: mval - call maxlocUpdate(mval) + call maxlocUpdate(mval, back) end subroutine maxlocPartialMaskR_32F1D - attributes(device) subroutine maxlocUpdateR_32F(mval) + attributes(device) subroutine maxlocUpdateR_32F(mval, back) real(4) :: mval + logical :: back end subroutine maxlocUpdateR_32F - attributes(device) subroutine maxlocUpdateR_64F(mval) + attributes(device) subroutine maxlocUpdateR_64F(mval, back) real(8) :: mval + logical :: back end subroutine maxlocUpdateR_64F end module