[flang-commits] [flang] [llvm] [flang-rt] - Lightweight runtime assignment function (AssignSimple) for intrinsic-type assignments. (PR #213695)

via flang-commits flang-commits at lists.llvm.org
Mon Aug 3 08:00:04 PDT 2026


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 h,cpp -- flang-rt/lib/runtime/assign.cpp flang-rt/lib/runtime/tools.cpp flang-rt/unittests/Runtime/Assign.cpp flang/include/flang/Runtime/assign.h --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-rt/lib/runtime/assign.cpp b/flang-rt/lib/runtime/assign.cpp
index 2de590abd..d3d464c2e 100644
--- a/flang-rt/lib/runtime/assign.cpp
+++ b/flang-rt/lib/runtime/assign.cpp
@@ -866,9 +866,8 @@ void RTDEF(AssignSimple)(Descriptor &to, const Descriptor &from,
         to.rank(), from.rank());
   }
   if (to.ElementBytes() != from.ElementBytes()) {
-    terminator.Crash(
-        "AssignSimple: ElementBytes mismatch (to.ElementBytes=%d, "
-        "from.ElementBytes=%d)",
+    terminator.Crash("AssignSimple: ElementBytes mismatch (to.ElementBytes=%d, "
+                     "from.ElementBytes=%d)",
         to.ElementBytes(), from.ElementBytes());
   }
   if (to.type().IsDerived()) {
@@ -968,7 +967,7 @@ void RTDEF(AssignSimple)(Descriptor &to, const Descriptor &from,
       from.GetLowerBounds(fromAt);
       char *tempAt{tempBuffer};
       for (std::size_t n{elements}; n-- > 0;
-           from.IncrementSubscripts(fromAt), tempAt += elementBytes) {
+          from.IncrementSubscripts(fromAt), tempAt += elementBytes) {
         runtime::memcpy(tempAt, from.Element<const char>(fromAt), elementBytes);
       }
     }
@@ -1038,7 +1037,7 @@ void RTDEF(AssignSimple)(Descriptor &to, const Descriptor &from,
       to.GetLowerBounds(toAt);
       const char *tempAt{tempBuffer};
       for (std::size_t n{elements}; n-- > 0;
-           to.IncrementSubscripts(toAt), tempAt += elementBytes) {
+          to.IncrementSubscripts(toAt), tempAt += elementBytes) {
         runtime::memcpy(to.Element<char>(toAt), tempAt, elementBytes);
       }
     }
@@ -1057,7 +1056,7 @@ void RTDEF(AssignSimple)(Descriptor &to, const Descriptor &from,
       SubscriptValue fromAt[maxRank];
       from.GetLowerBounds(fromAt);
       for (std::size_t n{elements}; n-- > 0;
-           to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
+          to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
         runtime::memmove(to.Element<char>(toAt),
             from.Element<const char>(fromAt), elementBytes);
       }

``````````

</details>


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


More information about the flang-commits mailing list