summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund2017-10-13 18:54:59 +0000
committerAndres Freund2017-10-13 19:15:06 +0000
commitd133982d598c7e6208d16cb4fc0b552151796603 (patch)
treeb6d6f6d66febae9a59e43fb2e9b3c5a1419427d1
parent6393613b6a1e0feae3d22af608397b252cee5b58 (diff)
Force "restrict" not to be used when compiling with xlc.
Per buildfarm animal Hornet and followup manual testing by Noah Misch, it appears xlc miscompiles code using "restrict" in at least some cases. Allow disabling restrict usage with FORCE_DISABLE_RESTRICT=yes in template files, and do so for aix/xlc. Author: Andres Freund and Tom Lane Discussion: https://postgr.es/m/[email protected]
-rwxr-xr-xconfigure6
-rw-r--r--configure.in6
-rw-r--r--src/template/aix4
3 files changed, 14 insertions, 2 deletions
diff --git a/configure b/configure
index cdcb3ceb0c8..4ecd2e19224 100755
--- a/configure
+++ b/configure
@@ -12466,6 +12466,10 @@ fi
# spelling it understands, because it conflicts with
# __declspec(restrict). Therefore we define pg_restrict to the
# appropriate definition, which presumably won't conflict.
+#
+# Allow platforms with buggy compilers to force restrict to not be
+# used by setting $FORCE_DISABLE_RESTRICT=yes in the relevant
+# template.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
if ${ac_cv_c_restrict+:} false; then :
@@ -12512,7 +12516,7 @@ _ACEOF
;;
esac
-if test "$ac_cv_c_restrict" = "no" ; then
+if test "$ac_cv_c_restrict" = "no" -o "x$FORCE_DISABLE_RESTRICT" = "xyes"; then
pg_restrict=""
else
pg_restrict="$ac_cv_c_restrict"
diff --git a/configure.in b/configure.in
index 32bb7bf940d..cea7fd07553 100644
--- a/configure.in
+++ b/configure.in
@@ -1329,8 +1329,12 @@ PGAC_TYPE_LOCALE_T
# spelling it understands, because it conflicts with
# __declspec(restrict). Therefore we define pg_restrict to the
# appropriate definition, which presumably won't conflict.
+#
+# Allow platforms with buggy compilers to force restrict to not be
+# used by setting $FORCE_DISABLE_RESTRICT=yes in the relevant
+# template.
AC_C_RESTRICT
-if test "$ac_cv_c_restrict" = "no" ; then
+if test "$ac_cv_c_restrict" = "no" -o "x$FORCE_DISABLE_RESTRICT" = "xyes"; then
pg_restrict=""
else
pg_restrict="$ac_cv_c_restrict"
diff --git a/src/template/aix b/src/template/aix
index b566ff129df..ed832849dae 100644
--- a/src/template/aix
+++ b/src/template/aix
@@ -10,6 +10,10 @@ if test "$GCC" != yes ; then
CFLAGS="-O2 -qmaxmem=16384 -qsrcmsg"
;;
esac
+
+ # Due to a compiler bug, see [email protected] for details,
+ # force restrict not to be used when compiling with xlc.
+ FORCE_DISABLE_RESTRICT=yes
fi
# Native memset() is faster, tested on: