Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bf9Yt-0004Ew-C6 for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2016 17:44:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bf9Ys-0006Y1-V5 for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2016 17:44:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bf9XU-00051d-LQ for pgsql-hackers@postgresql.org; Wed, 31 Aug 2016 17:43:04 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bf9XR-0002gm-BX for pgsql-hackers@postgresql.org; Wed, 31 Aug 2016 17:43:04 +0000 Received: by mail-wm0-x22a.google.com with SMTP id w2so41425524wmd.0 for ; Wed, 31 Aug 2016 10:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=VgP3o5FZZ73QknYoGK384hJZb5ntWT++JIuY6s7S0c8=; b=wBvf4QfcctD1PenlIHssrY3CTSm2ZCPmW/L5zw88P5u7FjKOByRYttZTmAvsZWvj4v tdjnVX7h6juL0gzYe6waq5iPCFsX0E7FLuIOvo/4+vz+67AYjmtC3Y3VA+bT2PJjlg0j +MlC1Bq5W2AM1O7SiruKFEblrAlCECckvlB5fMTih+i+IRUiPsQq1wKfqh1fFoQCmoJd G7KAtjxKlTaSr78Lt2inCN6krlFUf22JTihkdbM+/fE4LgD5vFa+ABwNqVQS8ieabw3Y EZWbNAw5BnS2WX7JM2GKsIdFtOs/e5Vo3vZgMUtzFK3V8UL04JAuEduq2kP7G1Mf5ud6 fGXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=VgP3o5FZZ73QknYoGK384hJZb5ntWT++JIuY6s7S0c8=; b=hdCuCUDZnRCsFf+ifIrnXbrpqaL/87PCf3ZvCPMg4bsPeK7xtV80ZpNKejNL37xwtQ /xkHJqd9yNKvQTQwUetkgtqnoUvgiK5521kGWPXoGYdxz+csqOig9vok9JRbOis2jOr4 UaW9a8OiTEFCQWooT8APlOtQRB9uJIOd9OypZiGc82zlD77pn+1mOVNnvv2LLg5nw/CT PZSTQg126eUi6uiUktxSYE9qOLeZi7RlE/H4YYyQFNsh1N6J4aKkiZvi92MmlzIGmYC2 POkuqb+BdEdwl2HK4vZs7/WKqR073ZMC2Kv/4Z0owRwpZaEd8dbKG9Z6pEnNVq3H8qBj 6Ejw== X-Gm-Message-State: AE9vXwMIEbF+YQ+F9R2PqLEn1weV7+Fm5DWORKkzYsz8GpeirAMl+WBCo/oMBTN6q4zvtw== X-Received: by 10.194.112.68 with SMTP id io4mr5869890wjb.2.1472665380015; Wed, 31 Aug 2016 10:43:00 -0700 (PDT) Received: from [192.168.1.111] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id f10sm925367wje.14.2016.08.31.10.42.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Aug 2016 10:42:59 -0700 (PDT) Subject: Re: [COMMITTERS] pgsql: Use static inline functions for float <-> Datum conversions. To: Tom Lane References: <4640.1472664476@sss.pgh.pa.us> Cc: pgsql-hackers@postgresql.org From: Heikki Linnakangas Message-ID: <8e543348-89d0-02c0-21d3-65c3bb042294@iki.fi> Date: Wed, 31 Aug 2016 20:42:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: <4640.1472664476@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 08/31/2016 08:27 PM, Tom Lane wrote: > 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. Ugh. > 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. Sounds reasonable. None of this is supposed to be necessary, we're just working around broken compilers, so whatever works. I'll prepare a patch for that tomorrow, unless you're on it already. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers