public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
To: Andres Freund <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: [email protected]
Subject: Re: Defend against -ffast-math in meson builds
Date: Thu, 12 Mar 2026 07:11:45 +0000
Message-ID: <abJnMYy0R/[email protected]> (raw)
In-Reply-To: <vjpqvlolycvkc3k6elcb3wchf7mjg6bn5ek7b352cvsnq77qln@nnjpkw3cykly>
References: <[email protected]>
	<vwnxbsap65km373ghtqhhvhwnc35suwraegb7z5op4okxyuwzu@kpaumampogpe>
	<[email protected]>
	<[email protected]>
	<abGPko4lPv/[email protected]>
	<[email protected]>
	<[email protected]>
	<vjpqvlolycvkc3k6elcb3wchf7mjg6bn5ek7b352cvsnq77qln@nnjpkw3cykly>

Hi,

On Wed, Mar 11, 2026 at 02:10:54PM -0400, Andres Freund wrote:
> Hi,
> 
> > it compiles fine with CFLAGS="-ffast-math" CC="gcc" meson setup meson_build but
> > produces issues during the regression tests.
> 
> This fails to build here as expected.
> 
> Are you sure that you actually specified it during meson setup and then didn't
> reconfigure while the CFLAGs aren't specified?

I was doing:

CFLAGS="-ffast-math" CC="gcc" meson setup meson_build
cd meson_build
meson configure -Db_coverage=true -Dbuildtype=debug -Dprefix=${PGINSTROOT} -Dpgport=${PGPORT} -Ddtrace=enabled -Dc_args="-Og -frecord-gcc-switches"
ninja -v
ninja -v install

to produce the oddity.

> 
> > 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
> 
> It's added to both, compile and link args, afaict?
> 
> andres@awork3:/tmp/pg-fast-math$ grep ffast-math build.ninja |awk '{print $1}'|sort|uniq -c
>    1679 ARGS
>     255 LINK_ARGS

That's right (and fails at compilation time) if doing a one step approach:

CFLAGS="-ffast-math -Og -frecord-gcc-switches" CC="gcc" meson setup meson_build -Db_coverage=true -Dbuildtype=debug -Dprefix=${PGINSTROOT} -Dpgport=${PGPORT} -Ddtrace=enabled

So, it's possible to produce this oddity with meson with the 2 steps approach,
while I don't think that would be possible with autoconf. That's why I think
the guard in meson.build would be a good thing to have, thoughts?

Regards,

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





view thread (14+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Defend against -ffast-math in meson builds
  In-Reply-To: <abJnMYy0R/[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox