refactor: Use immediate lambda to work around GCC bug 117966 #31493

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2412-gcc-workaround changing 1 files +4 −1
  1. maflcko commented at 2:46 pm on December 13, 2024: member

    Currently the libstdc++ debug mode can only be used with version 11, or 15 (and later), due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117966

    This seems restrictive.

    Add a temporary workaround for now, which makes the global (temporary) std::span local to a lambda.

  2. DrahtBot commented at 2:56 pm on December 13, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31493.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK theuni, hebasto, vasild

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. DrahtBot added the label Refactoring on Dec 13, 2024
  4. in src/pubkey.cpp:195 in fa12290549 outdated
    191@@ -192,7 +192,10 @@ int ecdsa_signature_parse_der_lax(secp256k1_ecdsa_signature* sig, const unsigned
    192  *  For an example script for calculating H, refer to the unit tests in
    193  *  ./test/functional/test_framework/crypto/secp256k1.py
    194  */
    195-constexpr XOnlyPubKey XOnlyPubKey::NUMS_H{"50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0"_hex_u8};
    196+constexpr XOnlyPubKey XOnlyPubKey::NUMS_H{
    


    theuni commented at 6:14 pm on December 13, 2024:

    Nice hack. Could use consteval on the lambda to enforce compile-time

    0constexpr XOnlyPubKey XOnlyPubKey::NUMS_H{
    1    // Use immediate lambda to work around GCC-14 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117966
    2    []() consteval { return XOnlyPubKey{"50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0"_hex_u8}; }(),
    3};
    

    maflcko commented at 10:17 am on December 16, 2024:

    I left it out to let the compiler decide whether to use it or not, just like before.

    Though, pushed consteval now, thx!

  5. theuni commented at 6:18 pm on December 13, 2024: member
    Concept ACK
  6. refactor: Use immediate lambda to work around GCC bug 117966 fa9e0489f5
  7. maflcko force-pushed on Dec 16, 2024
  8. theuni approved
  9. theuni commented at 5:04 pm on December 16, 2024: member
    utACK fa9e0489f57968945d54ef56b275f51540f3e5e4
  10. in src/pubkey.cpp:196 in fa9e0489f5
    191@@ -192,7 +192,10 @@ int ecdsa_signature_parse_der_lax(secp256k1_ecdsa_signature* sig, const unsigned
    192  *  For an example script for calculating H, refer to the unit tests in
    193  *  ./test/functional/test_framework/crypto/secp256k1.py
    194  */
    195-constexpr XOnlyPubKey XOnlyPubKey::NUMS_H{"50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0"_hex_u8};
    196+constexpr XOnlyPubKey XOnlyPubKey::NUMS_H{
    197+    // Use immediate lambda to work around GCC-14 bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117966
    


    hebasto commented at 11:39 am on December 17, 2024:
    nit: GCC-12 and GCC-13 seem also affected.

    fanquake commented at 11:43 am on December 17, 2024:
    That is documented in the link and PR description.

    maflcko commented at 11:48 am on December 17, 2024:

    nit: GCC-12 and GCC-13 seem also affected.

    The code is intentional, to only mention the last version of gcc where the workaround is needed. I don’t see the value to mention more than that.

  11. hebasto approved
  12. hebasto commented at 11:39 am on December 17, 2024: member
    ACK fa9e0489f57968945d54ef56b275f51540f3e5e4, tested on Ubuntu 24.10.
  13. vasild approved
  14. vasild commented at 2:07 pm on December 17, 2024: contributor
    ACK fa9e0489f57968945d54ef56b275f51540f3e5e4
  15. ryanofsky merged this on Dec 17, 2024
  16. ryanofsky closed this on Dec 17, 2024

  17. maflcko deleted the branch on Dec 18, 2024
  18. sedited referenced this in commit 230a439a4a on Jan 17, 2025
  19. stickies-v referenced this in commit d760fd3dda on Mar 17, 2025
  20. stickies-v referenced this in commit cc83553352 on Mar 17, 2025
  21. stickies-v referenced this in commit 2614933f06 on Mar 17, 2025
  22. stickies-v referenced this in commit b70418c5fc on Mar 17, 2025
  23. stickies-v referenced this in commit 69f8a1fe50 on Mar 17, 2025
  24. fanquake referenced this in commit 1dab8d0635 on Aug 6, 2025
  25. bug-castercv502 referenced this in commit 44b075fe71 on Sep 28, 2025
  26. bitcoin locked this on Dec 18, 2025

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: 2025-12-29 12:13 UTC

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