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 1w0NlY-001rKh-1F for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 17:54:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0NlW-00Aomy-2n for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 17:54:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0NlW-00Aomq-1w for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 17:54:39 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0NlT-00000002Ap8-3Kfb for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 17:54:38 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4838c15e3cbso1066825e9.3 for ; Wed, 11 Mar 2026 10:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773251675; x=1773856475; 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=9CFNhJE+vimPjPp1MUjz79c/N8TjoWeTMKfgGRvdq6o=; b=JfZrW6gakFkhpP2LZeG07TTEQsDyYxoQI4/eeAeftAc15wF28znKO44T3kUNSR8Pyo sn3f7QD2Rx3KfrL8ZkfohLbRfAVi6JiekOw11vd72k/ycx+gV+Z7twb5K0phnKYl54Cx YUmZseTwblorZFWa3ZDaRCk1k1iQH5Jg08X+xCv+RQbhHuwv7sIXV2vvzHagSMfBVi+D gxwHHXqaFkIPZTzSwqZRGxe4FRLywAQOvoOUm7ZILwAHBf9GUsMVLyGSfMb8BYLD4EBH CWAl3+TtfUXkBU6965E4xkgd5rlzwLy7+MEHZ5q5ENwegYuqCV3pXB/6wkf49MF6aq/F 7q2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773251675; x=1773856475; 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=9CFNhJE+vimPjPp1MUjz79c/N8TjoWeTMKfgGRvdq6o=; b=GFjiMIeQlc/ECcBz7R3af/GPg/AzvpK0Wv+8hczvN6Qgrl2gsDt+xz982ZQ1O//bqE sDRLpFOlBMMMBBWzDANH0VFoKQFzAlTGrpYr4pAB2AYQOqD8t4DLXCZueuYOjQBmhQFt NVuQCFD2FnW9alrGd6XoyUoEjSQmAXaHiAqCx8AS2Eq+jkrI6Q9l9fZ4xCA5F6eoOSNX c5rSH3Y27rQtipEDjtGl8nlP1fZS0YcSlcVBulz4bBfyvaoK5esr4lpd+svj/3D+atul 2VkMeKcjOBZCj6eZZS6szhjNQZ9lEAIbhYWI+wIm4RUVkErJkrRp7p9cfFK/VU68T5vt nDSg== X-Forwarded-Encrypted: i=1; AJvYcCWuy64JbQjumHmgAUm0NXqEYda5LRrSy2n8oN0jcJBY+5fw2ZZJpS2f4bYqcJfF7NLTXy17JWlkQFI+aPxn@lists.postgresql.org X-Gm-Message-State: AOJu0YxLRe5rjG4aHv9I2VVkuyx2+s/nMujpPudbvdbNxx9FhkE3r43f 5v9W9I8IZP/R5QxyuB/8QXD0YBQW5Z9YoO4LM8pzO+Auvmc2+rwbHJSAAT9ZRQ== X-Gm-Gg: ATEYQzw1OVtho2KTweeGiGsMNZM7Ja5EqrlFSGCjyLFy1aGwnnJCFNQrjd6N89gSqmy /J/c/FSd5l4t2ENkfyJVUXySmLM+r5sKLHrY/wLVWrq1o01EEtO7Qa/4bb0nuDtQv+sjMk/gWzx SjS0g23OBoC7WgM0UJ7g6z1McHQaPGCIp7Ae8AEUOMeiechBO9zpcdA/mvnvRVkUH6Kw1iz2S51 ip/g06RZrIVMvtJo1WnWLZqgQcg3LU8xke646gvCMXYB+cUlHV15jmaEw4exPxZCxO2WHnWySaV gmNntkWVbvfsCmG61xajFjdy1894RsA6xk2eWZTuaXK6rX9edk/WpTPExWizzOqpfKGMAAwiL+7 TcP2X+hE1qulJolY7LrvPuz/xZAKof06+1ySm/gQx/RlS+qaXQwTEBGLAV6qrnrC8RtPA/md7LF 5Vh9wx+js9N1NYcIENYFv4jopWHvKSgaXY0n26mvrlwqUmF6HgPd8RlQ2ngun1jWpprOZS/DLLX VGt//iA0ysFM1CDSw05ssgkL/X6K2hKxLEDbgsE4RVFn38rveWQViUefA== X-Received: by 2002:a05:600c:c3ce:20b0:485:4eaf:eb54 with SMTP id 5b1f17b1804b1-4854eafefdcmr19367565e9.20.1773251674529; Wed, 11 Mar 2026 10:54:34 -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-439fe20b544sm919686f8f.20.2026.03.11.10.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 10:54:34 -0700 (PDT) Date: Wed, 11 Mar 2026 17:54:33 +0000 From: Bertrand Drouvot To: Tom Lane Cc: Peter Eisentraut , Andres Freund , 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: <3583.1773247555@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Wed, Mar 11, 2026 at 12:45:55PM -0400, Tom Lane wrote: > Bertrand Drouvot writes: > > On Wed, Mar 11, 2026 at 11:19:45AM -0400, Tom Lane wrote: > >> The defenses in those modules are probably obsolete too: aren't they about > >> ensuring exact results with floating-point timestamps? My gut reaction to > >> this was maybe we could remove *all* of that, so now I'm curious what > >> problem Bertrand ran into. > > > I got some regression tests failing: [1]. > > Yeah. I quickly tried it here (ie remove the defenses and build with > -ffast-math), and observed failures in a couple dozen core regression > tests. A bit of study suggests that > > (1) both isnan() and isinf() tests are broken and always return false, > at least in some call sites; > > (2) the code now seems exceedingly cavalier about near-overflow cases, > such as > > regression=# select 1.175494e-38::float4; > ERROR: "0.00000000000000000000000000000000000001175494" is out of range for type real > > which is a case that works fine normally. > > So no, I don't wanna support this. Yeah, that would be a nightmare to support. > But maybe we should move the > code-level tests out of the datetime files and into utils/float.h > or some such place. 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 So that the code-level is ok, but the tests fail. [1]: https://postgr.es/m/abGO%2BBl1FQlpvFAt%40ip-10-97-1-34.eu-west-3.compute.internal Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com