[flang-commits] [flang] [flang][cuda] Relax assumed size check on object with device attribute (PR #89466)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Fri Apr 19 15:39:44 PDT 2024


https://github.com/clementval created https://github.com/llvm/llvm-project/pull/89466

Assumed size arrays are apparently allowed with attribute device.

>From fcd723d6d7793951f8d109bf6ee6c50ee30f4ae9 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Fri, 19 Apr 2024 15:38:28 -0700
Subject: [PATCH] [flang][cuda] Relax assumed size check on object with device
 attribute

---
 flang/lib/Semantics/check-declarations.cpp | 5 -----
 flang/test/Semantics/cuf03.cuf             | 3 +--
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 875929e90fdd31..c11617599b1986 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -948,11 +948,6 @@ void CheckHelper::CheckObjectEntity(
             "Component '%s' with ATTRIBUTES(DEVICE) must also be allocatable"_err_en_US,
             symbol.name());
       }
-      if (IsAssumedSizeArray(symbol)) {
-        messages_.Say(
-            "Object '%s' with ATTRIBUTES(DEVICE) may not be assumed size"_err_en_US,
-            symbol.name());
-      }
       break;
     case common::CUDADataAttr::Managed:
       if (!IsAutomatic(symbol) && !IsAllocatable(symbol) &&
diff --git a/flang/test/Semantics/cuf03.cuf b/flang/test/Semantics/cuf03.cuf
index 8decb8dcaa0f47..b6f9b80586a8f4 100644
--- a/flang/test/Semantics/cuf03.cuf
+++ b/flang/test/Semantics/cuf03.cuf
@@ -60,8 +60,7 @@ module m
  contains
   attributes(device) subroutine devsubr(n,da)
     integer, intent(in) :: n
-    !ERROR: Object 'da' with ATTRIBUTES(DEVICE) may not be assumed size
-    real, device :: da(*)
+    real, device :: da(*) ! ok
     real, managed :: ma(n) ! ok
     !WARNING: Pointer 'dp' may not be associated in a device subprogram
     real, device, pointer :: dp



More information about the flang-commits mailing list