Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0aD3-0021xX-2U for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 07:11:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0aD0-00DdOB-0l for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Mar 2026 07:11:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0aCz-00DdO2-35 for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2026 07:11:50 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0aCy-00000001jW1-33Pc for pgsql-hackers@lists.postgresql.org; Thu, 12 Mar 2026 07:11:49 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-439b73f4ab4so813961f8f.1 for ; Thu, 12 Mar 2026 00:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773299507; x=1773904307; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AbTQBjYZt4kQuB3YRTcZ1Fq7HWwLG+40OMVM/XcQPgQ=; b=PFg8jDAN/bho5Rt3JQYbf2E6ubGx9WuUFrdWN3nDAsgmtJ791piCRjC7DOFm16/J3q Cz4rETPTmx9sJJJZj1zrStg3W/sX02XWMw18E0h1R9zUNAkC0HU+SubES9ceC+B0FEZ3 4Fl9xoZneO8E2PS16kXhXnFW8P6dM7kkgEgPanvI7e/fU3ArEAWdv+vrCBQ9hsWxA0DT r1DoL+BHanjfRktfF9j/GRfb7aZoIs6T+At0GCcq7G0SHCC6gH9/XKnXS5Xlrx5XhmJP tbE5jwuHYPadHuDU4M3w145L9b4hFVN4NEITcEkLbEhE+kEGMfOhyh6XTmhCpkPxNJok fv5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773299507; x=1773904307; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AbTQBjYZt4kQuB3YRTcZ1Fq7HWwLG+40OMVM/XcQPgQ=; b=O94s0hOI8sRxe1juDlz7GU5/dZTFgxCBixCNciJlqB/FZqL+Px3NyBWS/uQll+Dbhk wB7x3dr3JaGsMKNjT5DWY5ZPefATuin/VLPfpGKEGUncluKgKJV6AXm1l9cJ29TR8xzc Jn7LBSpP85wkUPCvHGKpGI60rSKyey4GCPtiX3304rDl9nky/NHlRd7Ca/Wih1Gw2PCN khn8PWCFmijiQDnUI6Xzp6+RTVMabA+7EkSjH8lOoq10Tnjc1+Sh9psXzCCxB3aLiH0M /jeVGe8jjDfVT1OPCnvwB0QHowY/XF1MBr6FB37DnKzd5hok2hRV3TmRifvrsvCPQa/I N87w== X-Forwarded-Encrypted: i=1; AJvYcCU4Uq15ZzBi5TOcBMWJ/NDEGBMh5l0DZPw8fWSCAz9Z4XcxrEPrWRZY+mGZb+LT1R6mdBwJCSXtnrW0urR7@lists.postgresql.org X-Gm-Message-State: AOJu0YxjBW54/eqPA9D2bXuzGjXR4qmTqaNOZGEVbt3w1SvcXmDJCrD2 v5pHpVsNt3SJ0sDK23iDEm+ZZWnhxkTYukVIMKQ/RFUjLyX7d6OKRDo1 X-Gm-Gg: ATEYQzw5nz038nb4u5afEnXqtCNxA08FKY5BUiQRrauJtnijmQV9mFyhsVMWSQii+5p gCw7O8ge6038sK517LdPUXeAbMzyNwi9QnuyGmusmiG+hAHgYndEwnedR02vyGNDWobtMSnj0UP d+89HCuquc+p2ZYxpdg9qthJffm2hPz/DEhEEKW7Tu4PTmdd/p6p5EbKKIPmlbiBbOYOA4GKNxR x6jUAlDDCAsGWiu2qZZJNbjtlA6gKX6xZ2oG2NMTLFwrqldsOOlPit5PRjLdRLnTM8ewA+F4xCs 2C9HYAObN5DgI40bNeUfny6dpLitqk1HS8UK6OdaOCkCIm43K1JZg8eUFrH+gXkdObRh74aD7IJ MQKYSdc9FdomweWPJkXPjNQUA/5STtIrCUHOMeqVAIFICHXeaV29DNAFyvEwSr7xXrLGjD85Ys5 PLqY0kZCFwMpgRz7DnAJ/6inw3Eu0N+t3EvN9F9mQy3UBEGvRHt+NuN9cHSXt908pzfAfaNd+g/ Lly7qwlx6nfDxoAqi5zvgL8LXV25f895X4MgBv7ch7erjQFeIhGNCp3zQ== X-Received: by 2002:a05:6000:2509:b0:439:b28c:d47c with SMTP id ffacd0b85a97d-439f821a08fmr10422647f8f.37.1773299507124; Thu, 12 Mar 2026 00:11:47 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe2186e3sm7145047f8f.26.2026.03.12.00.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 00:11:46 -0700 (PDT) Date: Thu, 12 Mar 2026 07:11:45 +0000 From: Bertrand Drouvot To: Andres Freund Cc: Tom Lane , Peter Eisentraut , pgsql-hackers@lists.postgresql.org Subject: Re: Defend against -ffast-math in meson builds Message-ID: References: <3316.1773242385@sss.pgh.pa.us> <3583.1773247555@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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