Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebqgL-00044s-CP for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jan 2018 16:35:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ebqgK-0005zi-K3 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jan 2018 16:35:20 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ebqeO-0000yX-VL for pgsql-hackers@lists.postgresql.org; Wed, 17 Jan 2018 16:33:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ebqeL-0001wD-VE for pgsql-hackers@postgresql.org; Wed, 17 Jan 2018 16:33:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0HGX9Ei031744; Wed, 17 Jan 2018 11:33:09 -0500 From: Tom Lane To: Marina Polyakova cc: vitus@wagner.pp.ru, Andres Freund , pgsql-hackers@postgresql.org, Alvaro Herrera Subject: Re: master make check fails on Solaris 10 In-reply-to: <1c70bab595a37ffa3a7fafea29fa6f55@postgrespro.ru> References: <0d3a9fa264cebe1cb9966f37b7c06e86@postgrespro.ru> <20180111173938.jimybeayp2u5mmup@alap3.anarazel.de> <31a342fa6a025a8bdfc5b8b19c29d56d@postgrespro.ru> <1232.1515780057@sss.pgh.pa.us> <15299.1515867055@sss.pgh.pa.us> <18209.1516059711@sss.pgh.pa.us> <90ab676392c8f9c84431976147097cf0@postgrespro.ru> <17897.1516202926@sss.pgh.pa.us> <1c70bab595a37ffa3a7fafea29fa6f55@postgrespro.ru> Comments: In-reply-to Marina Polyakova message dated "Wed, 17 Jan 2018 18:50:05 +0300" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <31712.1516206763.0@sss.pgh.pa.us> Date: Wed, 17 Jan 2018 11:33:09 -0500 Message-ID: <31743.1516206789@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31712.1516206763.1@sss.pgh.pa.us> Attached is a draft patch to incorporate Victor's slimmed-down test into configure. If you have a chance, could you confirm it does the right thing on your Sparc machine? BTW, it would be a good idea to set up a buildfarm member on that machine, if you care about whether that configuration continues to work in the future. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="make-configure-check-for-gcc-bug.patch"; charset="us-ascii" Content-ID: <31712.1516206763.2@sss.pgh.pa.us> Content-Description: make-configure-check-for-gcc-bug.patch Content-Transfer-Encoding: quoted-printable diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 076656c..cbfccf6 100644 *** a/config/c-compiler.m4 --- b/config/c-compiler.m4 *************** AC_DEFUN([PGAC_TYPE_128BIT_INT], *** 108,136 **** [AC_CACHE_CHECK([for __int128], [pgac_cv__128bit_int], [AC_LINK_IFELSE([AC_LANG_PROGRAM([ /* * These are globals to discourage the compiler from folding all the * arithmetic tests down to compile-time constants. We do not have ! * convenient support for 64bit literals at this point... */ __int128 a =3D 48828125; ! __int128 b =3D 97656255; ],[ __int128 c,d; a =3D (a << 12) + 1; /* 200000000001 */ b =3D (b << 12) + 5; /* 400000000005 */ ! /* use the most relevant arithmetic ops */ c =3D a * b; d =3D (c + b) / b; ! /* return different values, to prevent optimizations */ if (d !=3D a+1) ! return 0; ! return 1; ])], [pgac_cv__128bit_int=3Dyes], [pgac_cv__128bit_int=3Dno])]) if test x"$pgac_cv__128bit_int" =3D xyes ; then ! AC_DEFINE(PG_INT128_TYPE, __int128, [Define to the name of a signed 12= 8-bit integer type.]) ! AC_CHECK_ALIGNOF(PG_INT128_TYPE) fi])# PGAC_TYPE_128BIT_INT = = --- 108,166 ---- [AC_CACHE_CHECK([for __int128], [pgac_cv__128bit_int], [AC_LINK_IFELSE([AC_LANG_PROGRAM([ /* + * We don't actually run this test, just link it to verify that any supp= ort + * functions needed for __int128 are present. + * * These are globals to discourage the compiler from folding all the * arithmetic tests down to compile-time constants. We do not have ! * convenient support for 128bit literals at this point... */ __int128 a =3D 48828125; ! __int128 b =3D 97656250; ],[ __int128 c,d; a =3D (a << 12) + 1; /* 200000000001 */ b =3D (b << 12) + 5; /* 400000000005 */ ! /* try the most relevant arithmetic ops */ c =3D a * b; d =3D (c + b) / b; ! /* must use the results, else compiler may optimize arithmetic away */ if (d !=3D a+1) ! return 1; ])], [pgac_cv__128bit_int=3Dyes], [pgac_cv__128bit_int=3Dno])]) if test x"$pgac_cv__128bit_int" =3D xyes ; then ! # Some versions of gcc have problems passing __int128 function argumen= ts ! # when using non-default alignment. Test that, if not cross-compiling= . ! AC_CACHE_CHECK([for __int128 alignment bug], [pgac_cv__128bit_int_bug]= , ! [AC_RUN_IFELSE([AC_LANG_PROGRAM([ ! /* This must match the corresponding code in c.h: */ ! #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__) ! #define pg_attribute_aligned(a) __attribute__((aligned(a))) ! #endif ! typedef __int128 int128a ! #if defined(pg_attribute_aligned) ! pg_attribute_aligned(8) ! #endif ! ; ! int128a holder; ! void pass_by_val(void *buffer, int128a par) { holder =3D par; } ! ],[ ! long int i64 =3D 97656225L << 12; ! int128a q; = ! pass_by_val(main, (int128a) i64); ! q =3D (int128a) i64; ! if (q !=3D holder) ! return 1; ! ])], ! [pgac_cv__128bit_int_bug=3Dok], ! [pgac_cv__128bit_int_bug=3Dbroken], ! [pgac_cv__128bit_int_bug=3Dassuming-ok])]) ! if test x"$pgac_cv__128bit_int_bug" !=3D xbroken ; then ! AC_DEFINE(PG_INT128_TYPE, __int128, [Define to the name of a signed = 128-bit integer type.]) ! AC_CHECK_ALIGNOF(PG_INT128_TYPE) ! fi fi])# PGAC_TYPE_128BIT_INT = = diff --git a/configure b/configure index 45221e1..6eaed45 100755 *** a/configure --- b/configure *************** else *** 14996,15007 **** /* end confdefs.h. */ = /* * These are globals to discourage the compiler from folding all the * arithmetic tests down to compile-time constants. We do not have ! * convenient support for 64bit literals at this point... */ __int128 a =3D 48828125; ! __int128 b =3D 97656255; = int main () --- 14996,15010 ---- /* end confdefs.h. */ = /* + * We don't actually run this test, just link it to verify that any supp= ort + * functions needed for __int128 are present. + * * These are globals to discourage the compiler from folding all the * arithmetic tests down to compile-time constants. We do not have ! * convenient support for 128bit literals at this point... */ __int128 a =3D 48828125; ! __int128 b =3D 97656250; = int main () *************** main () *** 15010,15022 **** __int128 c,d; a =3D (a << 12) + 1; /* 200000000001 */ b =3D (b << 12) + 5; /* 400000000005 */ ! /* use the most relevant arithmetic ops */ c =3D a * b; d =3D (c + b) / b; ! /* return different values, to prevent optimizations */ if (d !=3D a+1) ! return 0; ! return 1; = ; return 0; --- 15013,15024 ---- __int128 c,d; a =3D (a << 12) + 1; /* 200000000001 */ b =3D (b << 12) + 5; /* 400000000005 */ ! /* try the most relevant arithmetic ops */ c =3D a * b; d =3D (c + b) / b; ! /* must use the results, else compiler may optimize arithmetic away */ if (d !=3D a+1) ! return 1; = ; return 0; *************** fi *** 15033,15042 **** { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__128bit_int" >= &5 $as_echo "$pgac_cv__128bit_int" >&6; } if test x"$pgac_cv__128bit_int" =3D xyes ; then = $as_echo "#define PG_INT128_TYPE __int128" >>confdefs.h = ! # The cast to long int works around a bug in the HP C Compiler, # see AC_CHECK_SIZEOF for more information. { $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of PG_INT128= _TYPE" >&5 $as_echo_n "checking alignment of PG_INT128_TYPE... " >&6; } --- 15035,15097 ---- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__128bit_int" >= &5 $as_echo "$pgac_cv__128bit_int" >&6; } if test x"$pgac_cv__128bit_int" =3D xyes ; then + # Some versions of gcc have problems passing __int128 function argumen= ts + # when using non-default alignment. Test that, if not cross-compiling= . + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __int128 alignme= nt bug" >&5 + $as_echo_n "checking for __int128 alignment bug... " >&6; } + if ${pgac_cv__128bit_int_bug+:} false; then : + $as_echo_n "(cached) " >&6 + else + if test "$cross_compiling" =3D yes; then : + pgac_cv__128bit_int_bug=3Dassuming-ok + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + = + /* This must match the corresponding code in c.h: */ + #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__) + #define pg_attribute_aligned(a) __attribute__((aligned(a))) + #endif + typedef __int128 int128a + #if defined(pg_attribute_aligned) + pg_attribute_aligned(8) + #endif + ; + int128a holder; + void pass_by_val(void *buffer, int128a par) { holder =3D par; } + = + int + main () + { + = + long int i64 =3D 97656225L << 12; + int128a q; + pass_by_val(main, (int128a) i64); + q =3D (int128a) i64; + if (q !=3D holder) + return 1; + = + ; + return 0; + } + _ACEOF + if ac_fn_c_try_run "$LINENO"; then : + pgac_cv__128bit_int_bug=3Dok + else + pgac_cv__128bit_int_bug=3Dbroken + fi + rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + = + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__128bit_int_bu= g" >&5 + $as_echo "$pgac_cv__128bit_int_bug" >&6; } + if test x"$pgac_cv__128bit_int_bug" !=3D xbroken ; then = $as_echo "#define PG_INT128_TYPE __int128" >>confdefs.h = ! # The cast to long int works around a bug in the HP C Compiler, # see AC_CHECK_SIZEOF for more information. { $as_echo "$as_me:${as_lineno-$LINENO}: checking alignment of PG_INT128= _TYPE" >&5 $as_echo_n "checking alignment of PG_INT128_TYPE... " >&6; } *************** cat >>confdefs.h <<_ACEOF *** 15071,15076 **** --- 15126,15132 ---- _ACEOF = = + fi fi = # Check for various atomic operations now that we have checked how to de= clare ------- =_aaaaaaaaaa0--