Commit 50ebea6a authored by Ian Lynagh's avatar Ian Lynagh

Give -fwrapv to gcc when it supports it

Fixes trac #952: Haskell requires consistent overflow behaviour, which
gcc doesn't give without this flag.
parent 85c2ef54
......@@ -954,6 +954,18 @@ if test "$fp_cv_gcc_has_no_unit_at_a_time" = "yes"; then
AC_DEFINE([HAVE_GCC_HAS_NO_UNIT_AT_A_TIME], [1], [Define to 1 if gcc supports -fno-unit-at-a-time.])
fi])
# FP_GCC_HAS_WRAPV
# --------------------------
AC_DEFUN([FP_GCC_HAS_WRAPV],
[AC_REQUIRE([FP_HAVE_GCC])
AC_CACHE_CHECK([whether gcc has -fwrapv], [fp_cv_gcc_has_wrapv],
[FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [3.4],
[fp_cv_gcc_has_wrapv=yes],
[fp_cv_gcc_has_wrapv=no])])
if test "$fp_cv_gcc_has_wrapv" = "yes"; then
AC_DEFINE([HAVE_GCC_HAS_WRAPV], [1], [Define to 1 if gcc supports -fwrapv.])
fi])
# FP_SETUP_PROJECT_VERSION
# ---------------------
AC_DEFUN([FP_SETUP_PROJECT_VERSION],
......
......@@ -880,6 +880,10 @@ runPhase cc_phase stop dflags basename suff input_fn get_output_fn maybe_loc
++ split_opt
++ include_paths
++ pkg_extra_cc_opts
#ifdef HAVE_GCC_HAS_WRAPV
-- We need consistent integer overflow (trac #952)
++ ["-fwrapv"]
#endif
))
return (next_phase, dflags, maybe_loc, output_fn)
......
......@@ -878,6 +878,7 @@ FP_HAVE_GCC
FP_MINGW_GCC
FP_GCC_NEEDS_NO_OMIT_LFPTR
FP_GCC_HAS_NO_UNIT_AT_A_TIME
FP_GCC_HAS_WRAPV
dnl ** figure out how to invoke cpp directly (gcc -E is no good)
AC_PROG_CPP
......
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