Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>, Victor Wagner <vitus@wagner.pp.ru>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-12-01T17:06:36Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2018-09-04 17:51:30 -0700, Andres Freund wrote:
>> My current proposal is thus to do add a check that does
>> #if defined(__clang__) && defined(__i386__) && !defined(__SSE2_MATH__)
>> something-that-fails
>> #endif
>> in an autoconf test, and have configure complain if that
>> fails. Something roughly along the lines of
>> "Compiling PostgreSQL with clang, on 32bit x86, requires SSE2 support. Use -msse2 or use gcc."

> Here's a patch along those lines.

I've been having an off-list discussion with the submitter of bug #14913
[1], in which the percentile_disc regression test returned unexpected
results.  The upshot of that is that he's using gcc 3.4.6 on x86 hardware,
and it is doing something that changes the roundoff behavior in this
line in orderedsetaggs.c:

                int64        row = (int64) ceil(p * rowcount);

gcc 3.4.6 is too old to have -fexcess-precision=standard of course, but
adding -msse2 to CFLAGS fixes the problem.  So it now seems to me that
we were too narrow-minded in thinking that only clang has this issue.

Looking at the buildfarm, our only extant member that is on x86, and
is not using clang, and doesn't have -fexcess-precision=standard, is
dromedary which is using Apple's old toolchain.  So the fact that it
isn't showing the problem isn't very good evidence about how widespread
this issue might be with older gcc versions.

I wonder whether we shouldn't remove the clang aspect of the test
you added, ie just make it read "if on x86, you must have either
-fexcess-precision=standard or -msse2".  Or should we go so far
as to have configure add -msse2 automatically?

			regards, tom lane

[1] https://www.postgresql.org/message-id/20171116224401.1466.68649%40wrigleys.postgresql.org


Commits

  1. Error out for clang on x86-32 without SSE2 support, no -fexcess-precision.

  2. Fix 8a934d677 for libc++ and make more include order resistant.