pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Pavel Borisov <pashkin.elfe@gmail.com>
Cc: Andrey M. Borodin <x4mmm@yandex-team.ru>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Darafei Komяpa Praliaskouski <me@komzpa.net>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Yet another fast GiST build
Date: Tue, 6 Oct 2020 16:19:31 +0300
Message-ID: <867aacfd-d1af-3eed-5e40-dfc334668d65@iki.fi> (raw)
In-Reply-To: <CALT9ZEHoDE_gteWRuCNpHee26fpr0SRh8nmYuicWUXc4DufqEw@mail.gmail.com>
References: <7d9158ca-d7cb-88f0-dbbd-1d5cec32b1ae@iki.fi>
	<8516B6A8-11B2-41A8-B7EB-D0C38ADD06C3@yandex-team.ru>
	<50e03197-6e75-faec-16dc-41a2a38f080c@iki.fi>
	<123F5F32-9A85-4D0B-9C7A-1686E6BBE15D@yandex-team.ru>
	<85df399a-e8a4-2369-f723-fd1a3a872575@iki.fi>
	<!63596817-db40-1093-c6ce-5dea7dac67c4@iki.fi>
	<884200.1600634472@sss.pgh.pa.us>
	<891385.1600636205@sss.pgh.pa.us>
	<20200920224446.GF30557@telsasoft.com>
	<896113.1600643169@sss.pgh.pa.us>
	<8269ca22-d275-0afe-633c-2342c7ba11e6@iki.fi>
	<e1d41317-7420-b7ba-0d88-19625012e31e@iki.fi>
	<47CD54A6-EE59-433A-96E2-6F4E5973CEF4@yandex-team.ru>
	<422beff9-0e01-9ce6-edb9-c2a2289e8eb9@iki.fi>
	<0A1DDF47-CAB7-4D6A-9677-B1800FFB6984@yandex-team.ru>
	<4D68C21F-9FB9-41DA-B663-FDFC8D143788@yandex-team.ru>
	<4098005f-e4b5-5904-4b33-335dd106c132@iki.fi>
	<3520A18A-5C38-4697-A2E3-F3BDE3496CD5@yandex-team.ru>
	<282f7007-326a-f3d6-7394-0e5ea52df84f@iki.fi>
	<CALT9ZEHoDE_gteWRuCNpHee26fpr0SRh8nmYuicWUXc4DufqEw@mail.gmail.com>

On 06/10/2020 14:05, Pavel Borisov wrote:
> I've been making tests with memory sanitizer

Thanks!

> and got one another error 
> in regression test create_index:
> CREATE INDEX gpointind ON point_tbl USING gist (f1);
> server closed the connection unexpectedly
> 
> with logfile:
> gistproc.c:1714:28: runtime error: 1e+300 is outside the range of 
> representable values of type 'float'
> SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior gistproc.c:1714:28
> 
> gistproc.c:
> 1714     z = point_zorder_internal(p->x, p->y);
> 
> Consider this a minor issue but unrelated to the other issues discussed. 
> It is reproduced on the last master 
> commit 0a3c864c32751fd29d021929cf70af421fd27370 after all changes into 
> Gist committed.
> 
> cflags="-DUSE_VALGRIND -Og -O0 -fsanitize=address -fsanitize=undefined 
> -fno-sanitize-recover=all -fno-sanitize=alignment -fstack-protector"

You get the same error with:

select (float8 '1e+300')::float4;

float.c:1204:11: runtime error: 1e+300 is outside the range of 
representable values of type 'float'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior float.c:1204:11 in

It boils down to casting a C double to float, when the value doesn't fit 
in float. I'm surprised that's undefined behavior, but I'm no C99 
lawyer. The code in dtof() expects it to yield Inf.

I'm inclined to shrug this off and say that the sanitizer is being 
over-zealous. Is there some compiler flag we should be setting, to tell 
it that we require specific behavior? Any other ideas?

- Heikki





view thread (111+ messages)  latest in thread

Message-ID: <867aacfd-d1af-3eed-5e40-dfc334668d65@iki.fi>
Permalink:  ../867aacfd-d1af-3eed-5e40-dfc334668d65@iki.fi/
Also on:    postgresql.org/message-id/867aacfd-d1af-3eed-5e40-dfc334668d65@iki.fi

 · 

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: pgsql-hackers@postgresql.org
  Cc: hlinnaka@iki.fi, pashkin.elfe@gmail.com, x4mmm@yandex-team.ru, tgl@sss.pgh.pa.us, pryzby@telsasoft.com, me@komzpa.net, thomas.munro@gmail.com, michael@paquier.xyz, a.korotkov@postgrespro.ru
  Subject: Re: Yet another fast GiST build
  In-Reply-To: <867aacfd-d1af-3eed-5e40-dfc334668d65@iki.fi>

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

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