From: Tom Lane <tgl@sss.pgh.pa.us>
To: Marina Polyakova <m.polyakova@postgrespro.ru>
Cc: vitus@wagner.pp.ru, Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org, Alvaro Herrera <alvherre@alvh.no-ip.org>
Subject: Re: master make check fails on Solaris 10
Date: Wed, 17 Jan 2018 11:33:09 -0500
Message-ID: <31743.1516206789@sss.pgh.pa.us> (raw)
In-Reply-To: <1c70bab595a37ffa3a7fafea29fa6f55@postgrespro.ru>
References: <0d3a9fa264cebe1cb9966f37b7c06e86@postgrespro.ru>
<20180111173938.jimybeayp2u5mmup@alap3.anarazel.de>
<31a342fa6a025a8bdfc5b8b19c29d56d@postgrespro.ru>
<fc3c1b52d2d4121cccfc13635005bbd0@postgrespro.ru>
<1232.1515780057@sss.pgh.pa.us>
<b946893927ccfd87146d8a7c9f3bbe29@postgrespro.ru>
<15299.1515867055@sss.pgh.pa.us>
<a5559105243efcf6fb619d86c5702115@postgrespro.ru>
<18209.1516059711@sss.pgh.pa.us>
<90ab676392c8f9c84431976147097cf0@postgrespro.ru>
<17897.1516202926@sss.pgh.pa.us>
<1c70bab595a37ffa3a7fafea29fa6f55@postgrespro.ru>
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
Attachments:make-configure-check-for-gcc-bug.patch (text/x-diff, 7.4K) downloaddiff --git a/config/c-compiler.m4 b/config/c-compiler.m4index 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 = 48828125;
! __int128 b = 97656255;
],[
__int128 c,d;
a = (a << 12) + 1; /* 200000000001 */
b = (b << 12) + 5; /* 400000000005 */
! /* use the most relevant arithmetic ops */
c = a * b;
d = (c + b) / b;
! /* return different values, to prevent optimizations */
if (d != a+1)
! return 0;
! return 1;
])],
[pgac_cv__128bit_int=yes],
[pgac_cv__128bit_int=no])])
if test x"$pgac_cv__128bit_int" = xyes ; 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])# 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 support+ * 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 = 48828125;
! __int128 b = 97656250;
],[
__int128 c,d;
a = (a << 12) + 1; /* 200000000001 */
b = (b << 12) + 5; /* 400000000005 */
! /* try the most relevant arithmetic ops */
c = a * b;
d = (c + b) / b;
! /* must use the results, else compiler may optimize arithmetic away */
if (d != a+1)
! return 1;
])],
[pgac_cv__128bit_int=yes],
[pgac_cv__128bit_int=no])])
if test x"$pgac_cv__128bit_int" = xyes ; then
! # Some versions of gcc have problems passing __int128 function arguments
! # 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 = par; }
! ],[
! long int i64 = 97656225L << 12;
! int128a q;
! pass_by_val(main, (int128a) i64);
! q = (int128a) i64;
! if (q != holder)
! return 1;
! ])],
! [pgac_cv__128bit_int_bug=ok],
! [pgac_cv__128bit_int_bug=broken],
! [pgac_cv__128bit_int_bug=assuming-ok])])
! if test x"$pgac_cv__128bit_int_bug" != 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/configureindex 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 = 48828125;
! __int128 b = 97656255;
int
main ()
--- 14996,15010 ----
/* end confdefs.h. */
/*
+ * We don't actually run this test, just link it to verify that any support+ * 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 = 48828125;
! __int128 b = 97656250;
int
main ()
*************** main ()
*** 15010,15022 ****
__int128 c,d;
a = (a << 12) + 1; /* 200000000001 */
b = (b << 12) + 5; /* 400000000005 */
! /* use the most relevant arithmetic ops */
c = a * b;
d = (c + b) / b;
! /* return different values, to prevent optimizations */
if (d != a+1)
! return 0;
! return 1;
;
return 0;
--- 15013,15024 ----
__int128 c,d;
a = (a << 12) + 1; /* 200000000001 */
b = (b << 12) + 5; /* 400000000005 */
! /* try the most relevant arithmetic ops */
c = a * b;
d = (c + b) / b;
! /* must use the results, else compiler may optimize arithmetic away */
if (d != 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" = 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" = xyes ; then
+ # Some versions of gcc have problems passing __int128 function arguments+ # when using non-default alignment. Test that, if not cross-compiling.+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __int128 alignment 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" = yes; then :+ pgac_cv__128bit_int_bug=assuming-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 = par; }+ + int+ main ()+ {+ + long int i64 = 97656225L << 12;+ int128a q;+ pass_by_val(main, (int128a) i64);+ q = (int128a) i64;+ if (q != holder)+ return 1;+ + ;+ return 0;+ }+ _ACEOF+ if ac_fn_c_try_run "$LINENO"; then :+ pgac_cv__128bit_int_bug=ok+ else+ pgac_cv__128bit_int_bug=broken+ 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_bug" >&5+ $as_echo "$pgac_cv__128bit_int_bug" >&6; }+ if test x"$pgac_cv__128bit_int_bug" != 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 declare
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: tgl@sss.pgh.pa.us, m.polyakova@postgrespro.ru, andres@anarazel.de, alvherre@alvh.no-ip.org
Subject: Re: master make check fails on Solaris 10
In-Reply-To: <31743.1516206789@sss.pgh.pa.us>
* 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