[libcxx-commits] [libcxx] [libc++] Fix UB in bitwise logic of {std, ranges}::{fill, fill_n} algorithms (PR #122410)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 15 13:52: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 6ffc4451037bbae26cce51fb80418f8e9ed2ac84 5349b7c7796dbee31251cacc62a3ad4ca26e7db2 --extensions h,,cpp -- libcxx/test/support/sized_allocator.h libcxx/include/__algorithm/fill_n.h libcxx/include/__bit_reference libcxx/include/__fwd/bit_reference.h libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill.pass.cpp libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/fill_n.pass.cpp libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill.pass.cpp libcxx/test/std/algorithms/alg.modifying.operations/alg.fill/ranges.fill_n.pass.cpp
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference
index 77ca62bfbe..40b983075c 100644
--- a/libcxx/include/__bit_reference
+++ b/libcxx/include/__bit_reference
@@ -10,9 +10,9 @@
 #ifndef _LIBCPP___BIT_REFERENCE
 #define _LIBCPP___BIT_REFERENCE
 
-#include <__assert>
 #include <__algorithm/copy_n.h>
 #include <__algorithm/min.h>
+#include <__assert>
 #include <__bit/countr.h>
 #include <__compare/ordering.h>
 #include <__config>
@@ -24,8 +24,8 @@
 #include <__memory/pointer_traits.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/enable_if.h>
-#include <__type_traits/is_unsigned.h>
 #include <__type_traits/is_constant_evaluated.h>
+#include <__type_traits/is_unsigned.h>
 #include <__type_traits/void_t.h>
 #include <__utility/swap.h>
 #include <climits>

``````````

</details>


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


More information about the libcxx-commits mailing list