|
Message-Id: <20240828152826.826990-1-alex@alexrp.com> Date: Wed, 28 Aug 2024 17:28:26 +0200 From: Alex Rønne Petersen <alex@...xrp.com> To: musl@...ts.openwall.com Cc: Alex Rønne Petersen <alex@...xrp.com> Subject: [PATCH] configure: prevent compilers from turning a * b + c into fma(a, b, c) I've seen Clang do this for expressions in the fma() implementation itself, which of course led to infinite recursion. This happened when targeting arm-linux-musleabi with full soft float mode and -march=armv8-a. I imagine it's possible for GCC to do similar silliness. Work around this by passing -ffp-contract=off for Clang and -mno-fused-madd for GCC. This matches what glibc's configure.ac does, FWIW. --- configure | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configure b/configure index bc9fbe48..7028793f 100755 --- a/configure +++ b/configure @@ -355,6 +355,15 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \ || { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; } tryflag CFLAGS_C99FSE -frounding-math +# +# Prevent the compiler from turning a * b + c into an fma() call. +# Clang at least has been known to do this in the implementation of +# fma() itself when targeting arm-linux-musleabi and armv8-a, causing +# infinite recursion. +# +tryflag CFLAGS_C99FSE -mno-fused-madd +tryflag CFLAGS_C99FSE -ffp-contract=off + # # Semantically we want to insist that our sources follow the # C rules for type-based aliasing, but most if not all real-world -- 2.40.1
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.