fuzzing: compilation error ‘__builtin_mul_overflow’ does not have pointer to integer type #18389

issue naumenkogs opened this issue on March 20, 2020
  1. naumenkogs commented at 12:29 AM on March 20, 2020: member

    I'm using Debian, compiling current master (5bf45fe2a9642f8ae8f8a12bcbf8f8b4770421ad) after configure with ./configure --disable-shared --enable-tests --enable-fuzz CC=${AFLPATH}/afl-clang CXX=${AFLPATH}/afl-clang++.

    Getting this error:

      CXX      test/fuzz/test_fuzz_key-fuzz.o
    afl-cc 2.52b by <lcamtuf@google.com>
    test/fuzz/integer.cpp:152:27: error: default initialization of an object of const type 'const SigningProvider' without a
          user-provided default constructor
        const SigningProvider store;
                              ^
                                   {}
    1 error generated.
    Makefile:14931: recipe for target 'test/fuzz/test_fuzz_integer-integer.o' failed
    

    If I configure for gcc, I get this error:

    test/fuzz/multiplication_overflow.cpp: In instantiation of ‘void {anonymous}::TestMultiplicationOverflow(FuzzedDataProvider&) [with T = bool]’:
    test/fuzz/multiplication_overflow.cpp:41:58:   required from here
    test/fuzz/multiplication_overflow.cpp:21:75: error: argument 3 in call to function ‘__builtin_mul_overflow’ does not have pointer to integer type
         const bool is_multiplication_overflow_builtin = __builtin_mul_overflow(i, j, &result_builtin);
                                                                               ^
    Makefile:15155: recipe for target 'test/fuzz/test_fuzz_multiplication_overflow-multiplication_overflow.o' failed
    

    Funny enough, it works on my macbook locally :) cc @practicalswift

  2. naumenkogs added the label Bug on Mar 20, 2020
  3. fanquake added the label Tests on Mar 20, 2020
  4. MarcoFalke commented at 12:55 PM on March 20, 2020: member
  5. practicalswift commented at 3:36 PM on March 20, 2020: contributor

    Thanks for the ping! I'll fix :)

  6. practicalswift commented at 4:20 PM on March 20, 2020: contributor

    @naumenkogs Thanks for reporting. The __builtin_mul_overflow issue is fixed by #18393.

    I cannot reproduce the "default initialization of an object of const type …" issue. What versions of AFL and gcc are you using? :)

  7. MarcoFalke commented at 4:56 PM on March 20, 2020: member

    I cannot reproduce the "default initialization of an object of const type …" issue. What versions of AFL and gcc are you using? :)

    If I had to guess, it is probably an older version of gcc, like 4.8 or 5.3

  8. naumenkogs commented at 4:58 PM on March 20, 2020: member

    I cannot reproduce the "default initialization of an object of const type …" issue. What versions of AFL and gcc are you using? :)

    This issue happens with clang: clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) AFL I'm using is 2.52b

  9. practicalswift commented at 8:40 AM on March 21, 2020: contributor

    @naumenkogs Are you able to reproduce it under a newer version of Clang? :)

    I'm usually running Clang 10 compiled from trunk but I now tested against Clang 4 which is the oldest version I have around. I'm unable to reproduce under Clang 4.

  10. MarcoFalke commented at 1:15 PM on March 21, 2020: member
  11. naumenkogs commented at 5:51 PM on March 21, 2020: member

    After updating clang, the clang issue got fixed. Should this be mentioned in docs? I think there's no such requirement for Bitcoin Core.

    As for the gcc issue — this still applies #18393 even after compilers update, waiting for the solution in that PR :)

  12. naumenkogs commented at 6:10 PM on March 22, 2020: member

    Fixed in 7c1ac70

  13. MarcoFalke referenced this in commit 97b0687501 on Mar 23, 2020
  14. MarcoFalke closed this on Mar 23, 2020

  15. DrahtBot locked this on Feb 15, 2022

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: 2026-04-16 18:14 UTC

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