math
math copied to clipboard
FIX: avoid overflow on overflow check for Mac M1
- x-ref https://github.com/scipy/scipy/pull/17432
- avoid calculating
[number]*tools::max_value<T>()to prevent overflows on Apple M1 processors
@mborland @jzmaddock Didn't realize the changes would be similar for all issues at the start, so consolidating all these small PRs into a single one
I believe SciPy is using this image and seeing the errors. It's about 9 months old and I wonder if updating to the latest may avoid these (compiler?) issues/bugs
I believe SciPy is using this image and seeing the errors. It's about 9 months old and I wonder if updating to the latest may avoid these (compiler?) issues/bugs
Might be worth updating. I am using macOS Ventura with Clang 14.0.0 on an M1 MacBook Pro and see none of the errors. Anyone on Ventura won't even have the option for the Clang 13 series.
I confess I'm liking this less and less: the code appears to be correct, something somewhere is generating incorrect code if spurious overflow is happening on a code branch that should never be taken. Plus volatile plays absolute havoc with compiler optimizers. I don't as it happens mind at all if this is the full extent of the issue, but I have a hunch that we're about to take a deep dive through a very deep rabbit hole, as the library is choc full of logic like this.
So I guess the questions are:
- is this fixed in the latest release as Matt suggests?
- If not, how come Matt and I are unable to reproduce? There still appears to be something critical missing.
- What's the Apple/Clang take on this? Is it a known issue upstream?
is this fixed in the latest release as Matt suggests?
Testing this out now
If not, how come Matt and I are unable to reproduce? There still appears to be something critical missing.
Sounds like neither of you have tried on this specific version of MacOS? I also notice it only shows up when -O2 or -O3 optimizations are enabled.
What's the Apple/Clang take on this? Is it a known issue upstream?
I wasn't able to find anything upstream, I'll submit an issue
What's the Apple/Clang take on this? Is it a known issue upstream?
I wasn't able to find anything upstream, I'll submit an issue
If you are able to make an extremely minimal reproducer like the GCC Bugzilla requires @NAThompson can route it to the right people at Apple.
What's the Apple/Clang take on this? Is it a known issue upstream?
I wasn't able to find anything upstream, I'll submit an issue
If you are able to make an extremely minimal reproducer like the GCC Bugzilla requires @NAThompson can route it to the right people at Apple.
Minimal reproducer (not sure how it compares to GCC Bugzilla) is in the upstream llvm-project issue: https://github.com/llvm/llvm-project/issues/60695#issue-1581432780
If you are able to make an extremely minimal reproducer like the GCC Bugzilla requires @NAThompson can route it to the right people at Apple.
@mborland The issue was rejected by Clang maintainers, I'll try looking up my Apple ID and submitting an issue there
Since the issue seems to be fixed in newer macOS I wouldn't be surprised if they don't investigate the bug either.