Hi hackers, while working on a patch (not shared yet), I had issues with floating-point and realized that we don't defend against -ffast-math in meson builds. We defend against in autoconf (because we don't want fast-math optimizations [1]), so the attached does the same for meson.
[1]: https://postgr.es/m/424007.1644003689%40sss.pgh.pa.us Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
>From b9802905ed709d1b08205af73bcd2a1125a4f2af Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot <[email protected]> Date: Wed, 11 Mar 2026 10:53:06 +0000 Subject: [PATCH v1] Defend against -ffast-math in meson builds We'are defending against -ffast-math in autoconf so this commit does the same for meson builds. --- meson.build | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meson.build b/meson.build index 2df54409ca6..65344172368 100644 --- a/meson.build +++ b/meson.build @@ -2144,6 +2144,13 @@ elif cc.links(''' cdata.set('HAVE__CPUIDEX', 1) endif +# Defend against -ffast-math +if not cc.compiles(''' +#ifdef __FAST_MATH__ +choke me +#endif''', name: 'ffast-math check', args: test_c_args) + error('do not put -ffast-math in CFLAGS') +endif # Defend against clang being used on x86-32 without SSE2 enabled. As current # versions of clang do not understand -fexcess-precision=standard, the use of -- 2.34.1
