diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp index 2c2866d590ae5..32583643dc0f2 100644 --- a/flang/lib/Semantics/check-declarations.cpp +++ b/flang/lib/Semantics/check-declarations.cpp @@ -1394,12 +1394,6 @@ void CheckHelper::CheckSubprogram( if (ClassifyProcedure(symbol) == ProcedureDefinitionClass::Internal) { messages_.Say(symbol.name(), "A device subprogram may not be an internal subprogram"_err_en_US); - } else if ((*cudaAttrs == common::CUDASubprogramAttrs::Device || - *cudaAttrs == common::CUDASubprogramAttrs::HostDevice) && - (symbol.owner().kind() != Scope::Kind::Module || - details.isInterface())) { - messages_.Say(symbol.name(), - "An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure"_err_en_US); } } if ((!details.cudaLaunchBounds().empty() || diff --git a/flang/test/Semantics/cuf02.cuf b/flang/test/Semantics/cuf02.cuf index 38b3e783d86b3..881a3005e2817 100644 --- a/flang/test/Semantics/cuf02.cuf +++ b/flang/test/Semantics/cuf02.cuf @@ -1,7 +1,6 @@ ! RUN: %python %S/test_errors.py %s %flang_fc1 module m interface - !ERROR: An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure attributes(device) subroutine exts1 end end interface @@ -44,6 +43,5 @@ module m end end -!ERROR: An ATTRIBUTES(DEVICE) subprogram must be a top-level module procedure attributes(device) subroutine exts1 end