Re: Defend against -ffast-math in meson builds

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Defend against -ffast-math in meson builds
Date: 2026-03-11 18:29:47
Message-ID: abG0m6D8bhSYTT0w@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Mar 11, 2026 at 02:03:28PM -0400, Tom Lane wrote:
> Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> writes:
> > But still, I'm not sure the code-level guard is enough for meson. I think we
> > need to put a guard in meson.build for the "oddity" described in [1]:
>
> > it compiles fine with CFLAGS="-ffast-math" CC="gcc" meson setup meson_build but
> > produces issues during the regression tests.
>
> > I just had a closer look and it looks like that the reason is that it's being
> > added at link time:
>
> > $ cat meson_build/build.ninja | grep LINK_ARGS | grep -c "ffast-math"
> > 254
>
> Oy. Surely that is a meson bug? AFAICS most of the effects of
> -ffast-math should occur at compile time. Perhaps it also results
> in linking a different version of libm, but that's not everything.
> So just transposing it into link flags is not okay.

What I can see is that with CFLAGS="-ffast-math", I get:

$ objdump -t meson_build/src/backend/postgres | grep crtfast
0000000000000000 l df *ABS* 0000000000000000 crtfastmath.c

but it's empty without it.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nazir Bilal Yavuz 2026-03-11 18:49:22 Re: Speed up COPY FROM text/CSV parsing using SIMD
Previous Message Greg Sabino Mullane 2026-03-11 18:26:14 Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch