Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-12-03 Thread Tom Lane
Andres Freund writes: > On 2018-12-01 17:28:54 -0500, Tom Lane wrote: >> I guess I wasn't precise enough: I meant add -msse2 if on x86 and >> compiler doesn't take -fexcess-precision=standard. > Hm, I still don't like that: It'd silently bump the minimum required > architecture. Like in the case

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-12-01 Thread Andres Freund
Hi, On 2018-12-01 17:28:54 -0500, Tom Lane wrote: > Andres Freund writes: > > On 2018-12-01 12:06:36 -0500, Tom Lane wrote: > >> Or should we go so far as to have configure add -msse2 automatically? > > > Probably not - there's several OSs / distributions that do not yet > > require an SSE2 capa

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-12-01 Thread Tom Lane
Andres Freund writes: > On 2018-12-01 12:06:36 -0500, Tom Lane wrote: >> 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". > That sounds reasonable. >> Or should we go s

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-12-01 Thread Andres Freund
Hi,m On 2018-12-01 12:06:36 -0500, Tom Lane wrote: > 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". That sounds reasonable. > Or should we go so far as to have configu

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-12-01 Thread Tom Lane
I wrote: > 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 > t

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-12-01 Thread Tom Lane
Andres Freund 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 t

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-20 Thread Andres Freund
Hi, On 2018-09-13 14:29:59 -0700, Andres Freund wrote: > 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

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-13 Thread Andres Freund
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

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Tom Lane
Andrew Gierth writes: > The problem is that if we're relying on -fexcess-precision=standard > semantics in places besides infinity checks, then we won't get those > semantics on clang/i386/no-sse2 since it has no comparable option. (What > are we doing about compilers for x86-32 other than clang a

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Andrew Gierth
> "Tom" == Tom Lane writes: >> At the very minimum, I believe FreeBSD project policy would require >> that the i386 packages for postgresql be built to run without SSE2. Tom> Well, can we tell them they have to use gcc to compile, or will Tom> that be against their policy too? That's no

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Tom Lane
Andrew Gierth writes: > "Tom" == Tom Lane writes: > Tom> If you wanted to argue that the set of people who still want to > Tom> run PG on pre-SSE2 hardware is the empty set, that'd be an easier > Tom> sell really. > At the very minimum, I believe FreeBSD project policy would require that > th

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Andrew Gierth
> "Peter" == Peter Eisentraut writes: > On 05/09/2018 18:42, Andres Freund wrote: >> Realistically we're going to be running into old versions of clang >> for a long time. And the importance of running i386 without SSE2 >> surely isn't increasing. So I don't really see an urgent need to d

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Andrew Gierth
> "Tom" == Tom Lane writes: Tom> If you wanted to argue that the set of people who still want to Tom> run PG on pre-SSE2 hardware is the empty set, that'd be an easier Tom> sell really. At the very minimum, I believe FreeBSD project policy would require that the i386 packages for postgres

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Andres Freund
On 2018-09-05 14:08:11 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2018-09-05 10:05:26 -0400, Tom Lane wrote: > >> One thought is that maybe we should provide a way to override this, > >> in case somebody really can't or doesn't want to use -msse2, and > >> is willing to put up with plat

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Tom Lane
Andres Freund writes: > On 2018-09-05 10:05:26 -0400, Tom Lane wrote: >> One thought is that maybe we should provide a way to override this, >> in case somebody really can't or doesn't want to use -msse2, and >> is willing to put up with platform-dependent float behavior. > IDK, people that are c

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Tom Lane
Andres Freund writes: > On 2018-09-05 18:55:34 +0200, Peter Eisentraut wrote: >> Another option perhaps is to let this be and accept it as alternative >> floating point behavior. We already have some of those. > -many. We'd directly violate our own error rules. I think that just from a regress

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Andres Freund
On 2018-09-05 18:55:34 +0200, Peter Eisentraut wrote: > On 05/09/2018 18:42, Andres Freund wrote: > > Realistically we're going to be running into old versions of clang for a > > long time. And the importance of running i386 without SSE2 surely isn't > > increasing. So I don't really see an urgen

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Peter Eisentraut
On 05/09/2018 18:42, Andres Freund wrote: > Realistically we're going to be running into old versions of clang for a > long time. And the importance of running i386 without SSE2 surely isn't > increasing. So I don't really see an urgent need to do anything about > it. And if it gets fixed, and we

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Andres Freund
Hi, On 2018-09-05 10:05:26 -0400, Tom Lane wrote: > Peter Eisentraut writes: > > On 05/09/2018 02:51, 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

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Tom Lane
Peter Eisentraut writes: > On 05/09/2018 02:51, 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 fa

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-05 Thread Peter Eisentraut
On 05/09/2018 02:51, 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 th

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Victor Wagner
On Tue, 4 Sep 2018 17:51:30 -0700 Andres Freund wrote: > #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." Adding CFLAGS=-msse2 to con

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andres Freund
On 2018-09-05 01:47:52 +0100, Andrew Gierth wrote: > > "Tom" == Tom Lane writes: > > >> I kinda wonder if we should add -mno-x87 or such in configure when > >> we detect clang, obviously it doesn't deal correctly with this. > > Tom> Seems worth looking into, but what happens if someone tr

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andrew Gierth
> "Tom" == Tom Lane writes: >> I kinda wonder if we should add -mno-x87 or such in configure when >> we detect clang, obviously it doesn't deal correctly with this. Tom> Seems worth looking into, but what happens if someone tries to Tom> compile for x87 hardware? Or do we care anymore?

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andres Freund
On 2018-09-04 19:02:02 -0400, Tom Lane wrote: > Andres Freund writes: > > ... Note that we've previously encountered similar issues > > on gcc, which is why we've tried to force gcc's hand with > > -fexcess-precision=standard. > > Right. Annoying that clang doesn't have that. We can't realistic

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Tom Lane
Andres Freund writes: > ... Note that we've previously encountered similar issues > on gcc, which is why we've tried to force gcc's hand with > -fexcess-precision=standard. Right. Annoying that clang doesn't have that. We can't realistically program around an issue that might or might not show

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andres Freund
Hi, On 2018-09-04 15:16:27 -0700, Andres Freund wrote: > I think this is pretty clearly a C99 violation by clang (note how gcc > automatically enables -fexcess-precision=standard in C99 mode). I'll > report something, but I've little hope this getting fixed quickly - and > it'll definitely not ge

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andres Freund
On 2018-09-04 15:16:27 -0700, Andres Freund wrote: > I'm now looking at how it comes that clang on linux doesn't default to > x87 math, but freebsd does. Oh well. I present you, without comments, the following: switch (Triple.getOS()) { case llvm::Triple::FreeBSD: case llvm::Triple::NetBSD:

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andres Freund
On 2018-09-04 17:46:29 -0400, Tom Lane wrote: > Andrew Gierth writes: > > The reason it behaves oddly is this: on i387 FPU (and NOT on arm32 or on > > 32-bit i386 with a modern architecture specified to the compiler), the > > result of 1e200 * 1e180 is not in fact infinite, because it fits in an >

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andrew Gierth
> "Tom" == Tom Lane writes: >> The reason it behaves oddly is this: on i387 FPU (and NOT on arm32 >> or on 32-bit i386 with a modern architecture specified to the >> compiler), the result of 1e200 * 1e180 is not in fact infinite, >> because it fits in an 80-bit long double. So __builtin_i

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andrew Gierth
> "Andrew" == Andrew Gierth writes: Andrew> Specifying a recent microarch makes it use 64-bit FP registers Andrew> rather than 80-bit ones: Andrew> cc -O2 -m32 -march=skylake flttst.c && ./a.out Andrew> r1 = 1, r2 = 1 where "recent" means "since about 2000 or so": cc -O2 -m32 -march=pe

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Tom Lane
Andrew Gierth writes: > The reason it behaves oddly is this: on i387 FPU (and NOT on arm32 or on > 32-bit i386 with a modern architecture specified to the compiler), the > result of 1e200 * 1e180 is not in fact infinite, because it fits in an > 80-bit long double. So __builtin_isinf reports that i

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andrew Gierth
> "Andrew" == Andrew Gierth writes: > "Andres" == Andres Freund writes: Andres> Thomas and I are sitting in a cafe and are trying to figure out Andres> what's going on... Andrew> I have a standalone test case: Andrew> #include Andrew> #include Andrew> int main(int argc, char *

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andrew Gierth
> "Andres" == Andres Freund writes: Andres> Thomas and I are sitting in a cafe and are trying to figure out Andres> what's going on... I have a standalone test case: #include #include int main(int argc, char **argv) { double d1 = (argc ? 1e180 : 0); double d2 = (argv ? 1e200 :

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andres Freund
On 2018-09-04 16:13:45 -0400, Tom Lane wrote: > Victor Wagner writes: > > Tom Lane пишет: > >> (I was testing PG HEAD, not the 11 branch, but I don't see a reason > >> to think that'd make a difference.) > > > Alas, it does. First thing I've done after discovering this bug, it is > > to look if

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andrew Gierth
> "Victor" == Victor Wagner writes: Victor> Do you reproducing problem in REL_11_STABLE? It doesn't exist Victor> in master. Oh, I missed that. It is reproducible on REL_11_STABLE with clang 3.9.1, I'll dig into it more. -- Andrew (irc:RhodiumToad)

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Tom Lane
Victor Wagner writes: > Tom Lane пишет: >> (I was testing PG HEAD, not the 11 branch, but I don't see a reason >> to think that'd make a difference.) > Alas, it does. First thing I've done after discovering this bug, it is > to look if it exists in master. And master passes this test on the same

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Thomas Munro
On Tue, Sep 4, 2018 at 12:59 PM Victor Wagner wrote: > > В Tue, 04 Sep 2018 15:48:24 -0400 > Tom Lane пишет: > > > > I tried to reproduce the problem, without success, on a few different > > FreeBSD images I had laying about: > > > > FreeBSD 11.0/x86_64, clang version 3.8.0 > > (this confir

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Victor Wagner
В Tue, 04 Sep 2018 15:48:24 -0400 Tom Lane пишет: > I tried to reproduce the problem, without success, on a few different > FreeBSD images I had laying about: > > FreeBSD 11.0/x86_64, clang version 3.8.0 > (this confirms OP's report that x86_64 is OK) > > FreeBSD 10.3/ppc, gcc 4.2.1 > >

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Victor Wagner
В Tue, 4 Sep 2018 11:06:56 -0700 Thomas Munro пишет: > On Tue, Sep 4, 2018 at 9:39 AM Andrew Gierth > wrote: > > > > > "Andres" == Andres Freund writes: > > > > >> However, this commit broke float8 test on 32-bit FreeBSD 11 with > > >> clang 3.8.0 compiler. Regressions.diff follows:

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Tom Lane
Thomas Munro writes: > On Tue, Sep 4, 2018 at 9:39 AM Andrew Gierth > wrote: >> I also confirmed that without #define isinf(x) __builtin_isinf(x), on >> both 32bit and 64bit fbsd isinf() compiles as a function call, so the >> OP's proposed change would not be desirable. Presumably what we are lo

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Thomas Munro
On Tue, Sep 4, 2018 at 9:39 AM Andrew Gierth wrote: > > > "Andres" == Andres Freund writes: > > >> However, this commit broke float8 test on 32-bit FreeBSD 11 with > >> clang 3.8.0 compiler. Regressions.diff follows: > > Andres> Does this happen with a newer clang version too? > > float8 t

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andrew Gierth
> "Andres" == Andres Freund writes: >> However, this commit broke float8 test on 32-bit FreeBSD 11 with >> clang 3.8.0 compiler. Regressions.diff follows: Andres> Does this happen with a newer clang version too? float8 test (and all other tests) passes for me on clang 3.9.1 on fbsd11 on

Re: Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Andres Freund
On September 4, 2018 6:16:24 AM PDT, Victor Wagner wrote: > >Collegues, > >Few days ago commit > > 1f349aa7d9a6633e87db071390c73a39ac279ba4 > >Fix 8a934d67 for libc++ and make more include order resistant. > >was introduced into branch REL_11_STABLE. >It seems that it deals with GLIBC-based s

Bug fix for glibc broke freebsd build in REL_11_STABLE

2018-09-04 Thread Victor Wagner
Collegues, Few days ago commit 1f349aa7d9a6633e87db071390c73a39ac279ba4 Fix 8a934d67 for libc++ and make more include order resistant. was introduced into branch REL_11_STABLE. It seems that it deals with GLIBC-based systems (i.e Linux and Hurd) only, and shouldn't affect systems with non-