Skip to content

Commit a4d9059

Browse files
authored
Merge pull request #3396 from eseiler/fix/bogus
fix(gcc-16): bogus warning with fedora
2 parents a13d694 + e6ddc25 commit a4d9059

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

include/seqan3/alphabet/container/bitpacked_sequence.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,33 @@ class bitpacked_sequence
8787
//!\brief Update the sdsl-proxy.
8888
constexpr void on_update() noexcept
8989
{
90+
// Alternative patch in the SDSL.
91+
// The problem is that, in the Fedora build type, there is a warning about accessing lo_set[65],
92+
// which is out of bounds (size is 64).
93+
// However, during runtime, lo_set[65] is never actually accessed (bogus warning).
94+
// Making `len > 64` undefined behaviour resolves the warning.
95+
// Note that the SDSL uses an older C++ standard and has not `std::unreachable()` available.
96+
// Also, `__builtin_unreachable()` is only valid for GCC and Clang. The SDSL also supports MSVC,
97+
// where there is an equivalent but different builtin for that.
98+
// The diff is for the amalgamated seqan3/contrib/sdsl-lite.hpp; but the patch should be applied upstream.
99+
// ```diff
100+
// diff --git a/include/seqan3/contrib/sdsl-lite.hpp b/include/seqan3/contrib/sdsl-lite.hpp
101+
// index a82da4ac2..b59628a56 100644
102+
// --- a/include/seqan3/contrib/sdsl-lite.hpp
103+
// +++ b/include/seqan3/contrib/sdsl-lite.hpp
104+
// @@ -510,6 +510,8 @@ constexpr uint32_t bits_impl<T>::sel11(uint64_t x, uint32_t i, uint32_t c)
105+
// template <typename T>
106+
// constexpr void bits_impl<T>::write_int(uint64_t * word, uint64_t x, uint8_t offset, const uint8_t len)
107+
// {
108+
// + if (len > 64)
109+
// + __builtin_unreachable();
110+
// x &= bits_impl<T>::lo_set[len];
111+
// if (offset + len < 64)
112+
// {
113+
// ```
114+
SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(-Warray-bounds)
90115
internal_proxy = base_t::to_rank();
116+
SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_STOP
91117
}
92118

93119
public:

0 commit comments

Comments
 (0)