pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Dodge portability issue (apparent compiler bug) in new tablesamp 2+ messages / 1 participants [nested] [flat]
* pgsql: Dodge portability issue (apparent compiler bug) in new tablesamp @ 2015-07-25 23:42 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2015-07-25 23:42 UTC (permalink / raw) To: pgsql-committers Dodge portability issue (apparent compiler bug) in new tablesample code. Some of the older OS X critters in the buildfarm are failing regression, with symptoms showing that a request for 100% sampling in BERNOULLI or SYSTEM methods actually gets only around 50% of the table. gdb revealed that the computation of the "cutoff" number was producing 0x7FFFFFFF rather than the expected 0x100000000. Inspecting the assembly code, it looks like gcc is trying to use lrint() instead of rint() and then fumbling the conversion from long double to uint64. This seems like a clear compiler bug, but assigning the intermediate result into a plain double variable works around it, so let's just do that. (Another idea would be to give up one bit of hash width so that we don't need to use a uint64 cutoff, but let's see if this is enough.) Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/d9476b83808a39d9985845071bf0a150a3063b37 Modified Files -------------- src/backend/access/tablesample/bernoulli.c | 4 +++- src/backend/access/tablesample/system.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Dodge portability issue (apparent compiler bug) in new tablesamp @ 2015-07-25 23:42 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2015-07-25 23:42 UTC (permalink / raw) To: pgsql-committers Dodge portability issue (apparent compiler bug) in new tablesample code. Some of the older OS X critters in the buildfarm are failing regression, with symptoms showing that a request for 100% sampling in BERNOULLI or SYSTEM methods actually gets only around 50% of the table. gdb revealed that the computation of the "cutoff" number was producing 0x7FFFFFFF rather than the expected 0x100000000. Inspecting the assembly code, it looks like gcc is trying to use lrint() instead of rint() and then fumbling the conversion from long double to uint64. This seems like a clear compiler bug, but assigning the intermediate result into a plain double variable works around it, so let's just do that. (Another idea would be to give up one bit of hash width so that we don't need to use a uint64 cutoff, but let's see if this is enough.) Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/d5b132bb626d126b6d0696f2f4068815053da115 Modified Files -------------- src/backend/access/tablesample/bernoulli.c | 4 +++- src/backend/access/tablesample/system.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2015-07-25 23:42 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-07-25 23:42 pgsql: Dodge portability issue (apparent compiler bug) in new tablesamp Tom Lane <tgl@sss.pgh.pa.us> 2015-07-25 23:42 pgsql: Dodge portability issue (apparent compiler bug) in new tablesamp Tom Lane <tgl@sss.pgh.pa.us>
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