Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bf9JA-0003Nf-M3 for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2016 17:28:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bf9JA-0007fN-8t for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2016 17:28:16 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bf9J9-0007cw-2k for pgsql-hackers@postgresql.org; Wed, 31 Aug 2016 17:28:15 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bf9J6-0001wy-1P for pgsql-hackers@postgresql.org; Wed, 31 Aug 2016 17:28:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u7VHRujO004641; Wed, 31 Aug 2016 13:27:56 -0400 From: Tom Lane To: Heikki Linnakangas cc: pgsql-hackers@postgresql.org Subject: Re: [COMMITTERS] pgsql: Use static inline functions for float <-> Datum conversions. In-reply-to: References: Comments: In-reply-to Heikki Linnakangas message dated "Wed, 31 Aug 2016 13:03:38 -0000" Date: Wed, 31 Aug 2016 13:27:56 -0400 Message-ID: <4640.1472664476@sss.pgh.pa.us> X-Pg-Spam-Score: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Heikki Linnakangas writes: > Use static inline functions for float <-> Datum conversions. Hmm, it looks like narwhal for one is not happy with this: http://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=narwhal&dt=2016-08-31%2016%3A00%3A03 I suspect the failure traces to this bit in pg_enum.c: /* * On some machines, newelemorder may be in a register that's * wider than float4. We need to force it to be rounded to float4 * precision before making the following comparisons, or we'll get * wrong results. (Such behavior violates the C standard, but * fixing the compilers is out of our reach.) */ newelemorder = DatumGetFloat4(Float4GetDatum(newelemorder)); If you suppose that inlining those macros allows gcc to decide that the assignment is a no-op, the observed failure would be explained. We had a bunch of similar problems in the recent work on exact degree trig functions, and eventually found that storing values into volatile float8 variables was the most reliable way to force rounding to the expected storage width. I propose to replace the above hack with declaring newelemorder as volatile, and see if that makes things better. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers