Commit d133982d authored by Andres Freund's avatar Andres Freund

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/1820.1507918762@sss.pgh.pa.us
parent 6393613b
...@@ -12466,6 +12466,10 @@ fi ...@@ -12466,6 +12466,10 @@ fi
# spelling it understands, because it conflicts with # spelling it understands, because it conflicts with
# __declspec(restrict). Therefore we define pg_restrict to the # __declspec(restrict). Therefore we define pg_restrict to the
# appropriate definition, which presumably won't conflict. # 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 "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
$as_echo_n "checking for C/C++ restrict keyword... " >&6; } $as_echo_n "checking for C/C++ restrict keyword... " >&6; }
if ${ac_cv_c_restrict+:} false; then : if ${ac_cv_c_restrict+:} false; then :
...@@ -12512,7 +12516,7 @@ _ACEOF ...@@ -12512,7 +12516,7 @@ _ACEOF
;; ;;
esac 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="" pg_restrict=""
else else
pg_restrict="$ac_cv_c_restrict" pg_restrict="$ac_cv_c_restrict"
......
...@@ -1329,8 +1329,12 @@ PGAC_TYPE_LOCALE_T ...@@ -1329,8 +1329,12 @@ PGAC_TYPE_LOCALE_T
# spelling it understands, because it conflicts with # spelling it understands, because it conflicts with
# __declspec(restrict). Therefore we define pg_restrict to the # __declspec(restrict). Therefore we define pg_restrict to the
# appropriate definition, which presumably won't conflict. # 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 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="" pg_restrict=""
else else
pg_restrict="$ac_cv_c_restrict" pg_restrict="$ac_cv_c_restrict"
......
...@@ -10,6 +10,10 @@ if test "$GCC" != yes ; then ...@@ -10,6 +10,10 @@ if test "$GCC" != yes ; then
CFLAGS="-O2 -qmaxmem=16384 -qsrcmsg" CFLAGS="-O2 -qmaxmem=16384 -qsrcmsg"
;; ;;
esac esac
# Due to a compiler bug, see 20171013023536.GA492146@rfd.leadboat.com for details,
# force restrict not to be used when compiling with xlc.
FORCE_DISABLE_RESTRICT=yes
fi fi
# Native memset() is faster, tested on: # Native memset() is faster, tested on:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment