diff options
author | Paul Kirth <paulkirth@google.com> | 2024-04-30 23:14:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-30 23:14:38 +0200 |
commit | 280cf8d64e00529d6060c1708042f01d7b817b90 (patch) | |
tree | bae94904d04dd82ffff354ec991b00c232b9e19c | |
parent | 380f22134cbebf326f051683ae7bfd92589a149e (diff) | |
parent | 1fb5083aed3f2bed3658f63ead895e2955f0bc4c (diff) |
Merge branch 'main' into users/ilovepi/spr/llvmnfc-document-clopt-variable-and-fix-typo-1upstream/users/ilovepi/spr/llvmnfc-document-clopt-variable-and-fix-typo-1
-rw-r--r-- | flang/lib/Semantics/check-declarations.cpp | 5 | ||||
-rw-r--r-- | flang/test/Semantics/cuf03.cuf | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp index 901ac20f8aae..d49c8e059591 100644 --- a/flang/lib/Semantics/check-declarations.cpp +++ b/flang/lib/Semantics/check-declarations.cpp @@ -984,7 +984,10 @@ void CheckHelper::CheckObjectEntity( } break; case common::CUDADataAttr::Unified: - if ((!subpDetails || inDeviceSubprogram) && !isComponent) { + if (((!subpDetails && + symbol.owner().kind() != Scope::Kind::MainProgram) || + inDeviceSubprogram) && + !isComponent) { messages_.Say( "Object '%s' with ATTRIBUTES(UNIFIED) must be declared in a host subprogram"_err_en_US, symbol.name()); diff --git a/flang/test/Semantics/cuf03.cuf b/flang/test/Semantics/cuf03.cuf index 472d53db7462..a98dd60cdb8a 100644 --- a/flang/test/Semantics/cuf03.cuf +++ b/flang/test/Semantics/cuf03.cuf @@ -89,3 +89,7 @@ module m end module + +program p + real, unified :: um ! ok +end program |