Bug in gsl 2.8 formula #6918
Unanswered
AlexBuccheri
asked this question in
Tap maintenance and Homebrew development
Replies: 1 comment
-
|
Is this Homebrew-specific, or can you reproduce this with GSL built without Homebrew? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description of the Problem
Homebrew GSL 2.8 arm64 macOS bottle can segfault when called from a GNU Fortran program compiled with
-ffpe-trap=zero.In GSL 2.8,
complex/math.c:gsl_complex_sqrtcontains:For input
4 + 0i,x = 4andy = 0, the source path should take thex >= ybranch and computey / x, i.e.0 / 4.However Homebrew bottle's optimized arm64 assembly speculatively emits both divisions before selecting the result (assembly produced by Codex 5.5):
When the GNU Fortran caller enables FP traps with
-ffpe-trap=zero, the speculative4 / 0traps even though that source branch should not be taken.Minimal Reproduction
I don't appear to be allowed to upload
.F90files so copy-pasting:README
Assumes Homebrew GSL is in the
$PATHConfigure with trapping:
cmake -B build --fresh \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_Fortran_COMPILER=/opt/homebrew/bin/gfortran-15 \ -DCMAKE_Fortran_FLAGS="-ffpe-trap=zero"Configure without trapping:
Build:
Run:
Solution
I think it's an Apple Clang problem. Compiling GSL with Apple Clang and the CFLAG
-ffp-exception-behavior=strictresolves the problem. Compiling with GCC is also an option (I did not test this).Note, it would be great to be able report these Issues on the core page without having to tick off the mandatory requirements. I appreciate they're deliberate barriers to entry, but I'm also not going to remove installations from requested directories in order to prove there's a problem.
Beta Was this translation helpful? Give feedback.
All reactions