All Major Linux Compilers miscomplie restrict #585

issue TheBlueMatt openend this issue on January 18, 2019
  1. TheBlueMatt commented at 2:40 am on January 18, 2019: contributor
    It looks like your project uses the “restrict” keyword. Both GCC since version 5 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87609) and CLANG for some time (https://bugs.llvm.org/show_bug.cgi?id=39282) can miscompile restrict-tagged pointers especially when called in loops/inlining. Seems “restrict” shouldn’t be used in modern C.
  2. jgarzik commented at 3:51 pm on January 18, 2019: none
    restrict is also used in the C library, glibc.
  3. TheBlueMatt commented at 4:43 pm on January 18, 2019: contributor
    What does that have to do with anything? Just cause one thing may be broken doesn’t mean we should also risk our own stuff being broken.
  4. jgarzik commented at 6:19 pm on January 18, 2019: none

    What does that have to do with anything? Just cause one thing may be broken doesn’t mean we should also risk our own stuff being broken.

    Well,

    • Anything using common functions is theoretically getting miscompiled, including pthread, stdlib, signal, stdio and string functions used by basically every project.
    • Miscompilation is happening, regardless of any action or inaction here. It will continue to impact bitcoin through dependencies, regardless of action/inaction here.

    It will take a long time to fix, so just remove restrict from secp256k1 and move on.

  5. sipa cross-referenced this on Jan 18, 2019 from issue Disable restrict keyword in GCC/Clang by sipa
  6. TheBlueMatt commented at 6:48 pm on January 18, 2019: contributor
    Thanks for the random comment? Still has no relevance to this issue or the fix. If you’re going to try to contribute to Bitcoin projects again, please try to be productive, don’t add tangential things just for the sake of it. Further, note that there are no known miscompilation bugs in glibc, especially given the auto-inlining of many relevant functions this seems unlikely to go unnoticed. You may wish to read the original bug reports linked in the first comment.
  7. real-or-random cross-referenced this on Sep 25, 2020 from issue memcmp may be miscompiled by GCC by real-or-random
  8. real-or-random commented at 8:29 am on December 20, 2022: contributor

    This has been fixed in GCC 7, 8 ,9 (>=7.4.1, >= 8.3.1, >= 9.0) and clang 12.

    Closing because I don’t think we want to take further action at this stage. If you don’t agree, please don’t hesitate to tell us.

  9. real-or-random closed this on Dec 20, 2022


github-metadata-mirror

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

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