Compile error with GCC 14.2 and -D_GLIBCXX_DEBUG #31515

issue hebasto openend this issue on December 17, 2024
  1. hebasto commented at 11:00 am on December 17, 2024: member

    The master branch @ b042c4f0538c6f9cdf8efbcef552796851e38a85 fails to compile with GCC 14.2 and -D_GLIBCXX_DEBUG:

     0$ cmake -B build -DCMAKE_CXX_FLAGS="-D_GLIBCXX_DEBUG"
     1$ cmake --build build --target bitcoind
     2[4/6] Building CXX object src/CMakeFiles/bitcoin_consensus.dir/pubkey.cpp.o
     3FAILED: src/CMakeFiles/bitcoin_consensus.dir/pubkey.cpp.o 
     4/usr/bin/ccache /usr/bin/c++  -I/home/hebasto/git/bitcoin/build/src -I/home/hebasto/git/bitcoin/src -I/home/hebasto/git/bitcoin/src/secp256k1/include -D_GLIBCXX_DEBUG -O2 -g -std=c++20 -fPIC -fno-extended-identifiers -fdebug-prefix-map=/home/hebasto/git/bitcoin/src=. -fmacro-prefix-map=/home/hebasto/git/bitcoin/src=. -fstack-reuse=none -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wno-unused-parameter -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -MD -MT src/CMakeFiles/bitcoin_consensus.dir/pubkey.cpp.o -MF src/CMakeFiles/bitcoin_consensus.dir/pubkey.cpp.o.d -o src/CMakeFiles/bitcoin_consensus.dir/pubkey.cpp.o -c /home/hebasto/git/bitcoin/src/pubkey.cpp 
     5In file included from /usr/include/c++/14/debug/debug.h:90,
     6                 from /usr/include/c++/14/bits/stl_algobase.h:69,
     7                 from /usr/include/c++/14/string:51,
     8                 from /home/hebasto/git/bitcoin/src/crypto/sha256.h:10,
     9                 from /home/hebasto/git/bitcoin/src/hash.h:12,
    10                 from /home/hebasto/git/bitcoin/src/pubkey.h:10,
    11                 from /home/hebasto/git/bitcoin/src/pubkey.cpp:6:
    12/home/hebasto/git/bitcoin/src/pubkey.cpp:195:116:   in constexpr expansion of std::span<const unsigned char>(util::hex_literals::operator""_hex_u8<util::detail::Hex<65>{std::array<std::byte, 32>{std::__array_traits<std::byte, 32>::_Type{(std::byte)80, (std::byte)146, (std::byte)155, (std::byte)116, (std::byte)193, (std::byte)160, (std::byte)73, (std::byte)84, (std::byte)183, (std::byte)139, (std::byte)75, (std::byte)96, (std::byte)53, (std::byte)233, (std::byte)122, (std::byte)94, (std::byte)7, (std::byte)138, (std::byte)90, (std::byte)15, (std::byte)40, (std::byte)236, (std::byte)150, (std::byte)213, (std::byte)71, (std::byte)191, (std::byte)238, (std::byte)154, (std::byte)206, (std::byte)128, (std::byte)58, (std::byte)192}}}>())
    13/usr/include/c++/14/span:202:57:   in constexpr expansion of ((std::span<const unsigned char>*)this)->std::span<const unsigned char>::span<const unsigned char*>((& __arr)->std::array<unsigned char, 32>::data(), 32)
    14/usr/include/c++/14/span:165:11: error: __builtin_expect(((long int)(! __gnu_debug::__valid_range<const unsigned char*>(__first, (__first + ((sizetype)__count))))), 0) is not a constant expression
    15  165 |           __glibcxx_requires_valid_range(__first, __first + __count);
    16      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    17ninja: build stopped: subcommand failed.
    

    The issue was introduced in 50bc017040ae300c795e3709233b80619db24518 from #30377.

  2. hebasto commented at 11:01 am on December 17, 2024: member
  3. fanquake closed this on Dec 17, 2024

  4. fanquake commented at 11:02 am on December 17, 2024: member
    Duplicate of #31436.
  5. hodlinator commented at 7:50 pm on December 18, 2024: contributor

    cc @hodlinator

    Thanks @hebasto. I started trying to update my environment yesterday to use newer GCC on NixOS but ran into (valid) compilation errors in other libraries and didn’t have time to correct them before the fix in #31493 got merged.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-21 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me