Skip to content

[flang][cuda] Relax assumed size check on object with device attribute #89466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

clementval
Copy link
Contributor

Assumed size arrays are apparently allowed with attribute device.

@clementval clementval requested review from klausler and wangzpgi April 19, 2024 22:39
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels Apr 19, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 19, 2024

@llvm/pr-subscribers-flang-semantics

Author: Valentin Clement (バレンタイン クレメン) (clementval)

Changes

Assumed size arrays are apparently allowed with attribute device.


Full diff: https://github.com/llvm/llvm-project/pull/89466.diff

2 Files Affected:

  • (modified) flang/lib/Semantics/check-declarations.cpp (-5)
  • (modified) flang/test/Semantics/cuf03.cuf (+1-2)
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

@clementval clementval merged commit c69efcd into llvm:main Apr 19, 2024
@clementval clementval deleted the cuda_device_assumed_size2 branch April 19, 2024 23:03
aniplcc pushed a commit to aniplcc/llvm-project that referenced this pull request Apr 21, 2024
llvm#89466)

Assumed size arrays are apparently allowed with attribute device.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants