Skip to content

Commit 85abb5b

Browse files
committed
Make PGAC_C_BUILTIN_OP_OVERFLOW link instead of just compiling.
Otherwise the detection can spuriously detect symbol as available, because the compiler may just emits reference to non-existant symbol.
1 parent 101c7ee commit 85abb5b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

config/c-compiler.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,11 @@ fi])# PGAC_C_BUILTIN_CONSTANT_P
305305
# and define HAVE__BUILTIN_OP_OVERFLOW if so.
306306
#
307307
# Check for the most complicated case, 64 bit multiplication, as a
308-
# proxy for all of the operations.
308+
# proxy for all of the operations. Have to link to be sure to
309+
# recognize a missing __builtin_mul_overflow.
309310
AC_DEFUN([PGAC_C_BUILTIN_OP_OVERFLOW],
310311
[AC_CACHE_CHECK(for __builtin_mul_overflow, pgac_cv__builtin_op_overflow,
311-
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
312+
[AC_LINK_IFELSE([AC_LANG_PROGRAM([],
312313
[PG_INT64_TYPE result;
313314
__builtin_mul_overflow((PG_INT64_TYPE) 1, (PG_INT64_TYPE) 2, &result);]
314315
)],

configure

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14472,6 +14472,8 @@ esac
1447214472

1447314473
fi
1447414474

14475+
# has to be down here, rather than with the other builtins, because
14476+
# the test uses PG_INT64_TYPE.
1447514477
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_mul_overflow" >&5
1447614478
$as_echo_n "checking for __builtin_mul_overflow... " >&6; }
1447714479
if ${pgac_cv__builtin_op_overflow+:} false; then :
@@ -14490,12 +14492,13 @@ __builtin_mul_overflow((PG_INT64_TYPE) 1, (PG_INT64_TYPE) 2, &result);
1449014492
return 0;
1449114493
}
1449214494
_ACEOF
14493-
if ac_fn_c_try_compile "$LINENO"; then :
14495+
if ac_fn_c_try_link "$LINENO"; then :
1449414496
pgac_cv__builtin_op_overflow=yes
1449514497
else
1449614498
pgac_cv__builtin_op_overflow=no
1449714499
fi
14498-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
14500+
rm -f core conftest.err conftest.$ac_objext \
14501+
conftest$ac_exeext conftest.$ac_ext
1449914502
fi
1450014503
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__builtin_op_overflow" >&5
1450114504
$as_echo "$pgac_cv__builtin_op_overflow" >&6; }

0 commit comments

Comments
 (0)