[flang-commits] [flang] aa7c104 - [flang][cuda] Allow fixed size array with the managed attribute (#89436)
via flang-commits
flang-commits at lists.llvm.org
Fri Apr 19 12:47:44 PDT 2024
Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-04-19T12:47:40-07:00
New Revision: aa7c104124ac4a8da12fbd25c797bc8ab438c545
URL: https://github.com/llvm/llvm-project/commit/aa7c104124ac4a8da12fbd25c797bc8ab438c545
DIFF: https://github.com/llvm/llvm-project/commit/aa7c104124ac4a8da12fbd25c797bc8ab438c545.diff
LOG: [flang][cuda] Allow fixed size array with the managed attribute (#89436)
Fixed size array and scalar should be allowed with the `managed`
attribute.
Added:
Modified:
flang/lib/Semantics/check-declarations.cpp
flang/test/Semantics/cuf03.cuf
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 875929e90fdd31..adbd21dfe6d436 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -956,9 +956,9 @@ void CheckHelper::CheckObjectEntity(
break;
case common::CUDADataAttr::Managed:
if (!IsAutomatic(symbol) && !IsAllocatable(symbol) &&
- !details.isDummy()) {
+ !details.isDummy() && !evaluate::IsExplicitShape(symbol)) {
messages_.Say(
- "Object '%s' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, or a dummy argument"_err_en_US,
+ "Object '%s' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, explicit shape, or a dummy argument"_err_en_US,
symbol.name());
}
break;
diff --git a/flang/test/Semantics/cuf03.cuf b/flang/test/Semantics/cuf03.cuf
index 8decb8dcaa0f47..020a1720aa2e4d 100644
--- a/flang/test/Semantics/cuf03.cuf
+++ b/flang/test/Semantics/cuf03.cuf
@@ -32,14 +32,11 @@ module m
real, shared, target :: mst
!ERROR: Object 'msa' with ATTRIBUTES(SHARED) must be declared in a device subprogram
real, shared :: msa(*)
- !ERROR: Object 'mm' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, or a dummy argument
- real, managed :: mm
- !ERROR: Object 'mmi' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, or a dummy argument
- real, managed :: mmi = 1.
+ real, managed :: mm ! ok
+ real, managed :: mmi = 1. ! ok
real, managed, allocatable :: mml ! ok
- !ERROR: Object 'mmp' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, or a dummy argument
- real, managed, pointer :: mmp ! ok
- !ERROR: Object 'mmt' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, or a dummy argument
+ !ERROR: Object 'mmp' with ATTRIBUTES(MANAGED) must also be allocatable, automatic, explicit shape, or a dummy argument
+ real, managed, pointer :: mmp(:)
real, managed, target :: mmt
!WARNING: Object 'mp' with ATTRIBUTES(PINNED) should also be allocatable
real, pinned :: mp
More information about the flang-commits
mailing list