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

via flang-commits flang-commits at lists.llvm.org
Fri Apr 19 15:55:27 PDT 2024


Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-04-19T15:55:24-07:00
New Revision: c69efcd54879835085cf03a09e1eec28dc80e1d3

URL: https://github.com/llvm/llvm-project/commit/c69efcd54879835085cf03a09e1eec28dc80e1d3
DIFF: https://github.com/llvm/llvm-project/commit/c69efcd54879835085cf03a09e1eec28dc80e1d3.diff

LOG: [flang][cuda] Relax assumed size check on object with device attribute (#89466)

Assumed size arrays are apparently allowed with attribute device.

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 adbd21dfe6d436..6fcee96dd69059 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 020a1720aa2e4d..472d53db7462ae 100644
--- a/flang/test/Semantics/cuf03.cuf
+++ b/flang/test/Semantics/cuf03.cuf
@@ -57,8 +57,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