[flang-commits] [flang] [flang][cuda] Emit error when a device actual argument is used in host intrinsic (PR #172914)

via flang-commits flang-commits at lists.llvm.org
Thu Dec 18 14:38:40 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- flang/include/flang/Semantics/scope.h flang/include/flang/Semantics/tools.h flang/lib/Semantics/check-call.cpp flang/lib/Semantics/resolve-names.cpp flang/lib/Semantics/tools.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp
index 2d2fefb5e..044075654 100644
--- a/flang/lib/Semantics/check-call.cpp
+++ b/flang/lib/Semantics/check-call.cpp
@@ -343,8 +343,8 @@ static bool DefersSameTypeParameters(
 
 // List of intrinsics that are skipped when checking for device actual
 // arguments.
-static const llvm::StringSet<> cudaSkippedIntrinsics = {"__builtin_c_f_pointer",
-    "__builtin_c_loc"};
+static const llvm::StringSet<> cudaSkippedIntrinsics = {
+    "__builtin_c_f_pointer", "__builtin_c_loc"};
 // List of intrinsics that can have a device actual argument if it is an
 // allocatable or pointer.
 static const llvm::StringSet<> cudaAllowedIntrinsics = {"size", "lbound",
@@ -1173,7 +1173,7 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
         // intrinsics.
         if (!actualLastSymbol || !IsAllocatableOrPointer(*actualLastSymbol) ||
             (IsAllocatableOrPointer(*actualLastSymbol) &&
-            !cudaAllowedIntrinsics.contains(intrinsic->name))) {
+                !cudaAllowedIntrinsics.contains(intrinsic->name))) {
           messages.Say(
               "Actual argument %s associated with host intrinsic %s is on the device"_err_en_US,
               actualLastSymbol->name(), intrinsic->name);

``````````

</details>


https://github.com/llvm/llvm-project/pull/172914


More information about the flang-commits mailing list