[flang-commits] [flang] [flang] Avoid left shifts of negative signed values (PR #84786)

via flang-commits flang-commits at lists.llvm.org
Mon Mar 11 09:27:47 PDT 2024


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 2a38551457cb2b38dcca35e30e9f2d7fce9ae3e7 566a9a5b09d66ee531b326ac1f4eae8ed5e241ee -- flang/include/flang/Evaluate/integer.h
``````````

</details>

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

``````````diff
diff --git a/flang/include/flang/Evaluate/integer.h b/flang/include/flang/Evaluate/integer.h
index 1e5f68104f..7db3aef460 100644
--- a/flang/include/flang/Evaluate/integer.h
+++ b/flang/include/flang/Evaluate/integer.h
@@ -481,7 +481,7 @@ public:
       // behavior in C++).
       auto u = std::make_unsigned_t<SINT>(ToUInt());
       u = (u >> (bits - 1)) << (bits - 1); // Get the sign bit only.
-      u = ~u + 1;                          // Negate top bits if not 0.
+      u = ~u + 1; // Negate top bits if not 0.
       n |= static_cast<SINT>(u);
     }
     return n;

``````````

</details>


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


More information about the flang-commits mailing list