All Major Linux Compilers miscomplie restrict #585
issue TheBlueMatt openend this issue on January 18, 2019-
TheBlueMatt commented at 2:40 am on January 18, 2019: contributorIt 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.
-
jgarzik commented at 3:51 pm on January 18, 2019: none
restrict
is also used in the C library, glibc. -
TheBlueMatt commented at 4:43 pm on January 18, 2019: contributorWhat 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.
-
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. -
sipa cross-referenced this on Jan 18, 2019 from issue Disable restrict keyword in GCC/Clang by sipa
-
TheBlueMatt commented at 6:48 pm on January 18, 2019: contributorThanks 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.
-
real-or-random cross-referenced this on Sep 25, 2020 from issue memcmp may be miscompiled by GCC by real-or-random
-
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.
-
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-10-30 05:15 UTC
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-10-30 05:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me