New configuration flag, --without-fpe, to disable floating point exception code in platforms that have buggy implementations of feenableexcept().

This commit is contained in:
Juan Jose Garcia Ripoll 2008-09-09 22:09:53 +02:00
parent 1fbd480784
commit fe923a9251
5 changed files with 43 additions and 4 deletions

View file

@ -39,6 +39,9 @@ ECL 8.9.0:
- In Unix-type systems, ECL now installs with a "soname" and using versioned
directory names, such as /usr/lib/ecl-8.9.0, /usr/lib/libecl.so.8.9, etc
- New configuration flag, --without-fpe, to disable floating point exception
code in platforms that have buggy implementations of feenableexcept().
* Bugs fixed:
- The optimizer for COERCE might enter an infinite loop for certain

View file

@ -16,7 +16,7 @@
*/
#include <ecl/ecl.h>
#if defined(HAVE_FENV_H)
#if defined(HAVE_FENV_H) && !defined(ECL_AVOID_FENV_H)
# define _GNU_SOURCE
# include <fenv.h>
# ifndef FE_UNDERFLOW
@ -88,7 +88,7 @@ handle_signal(int sig)
break;
case SIGFPE: {
cl_object condition = @'arithmetic-error';
#if defined(HAVE_FENV_H)
#if defined(HAVE_FENV_H) & !defined(ECL_AVOID_FENV_H)
int bits = fetestexcept(FE_ALL_EXCEPT);
if (bits & FE_DIVBYZERO)
condition = @'division-by-zero';
@ -298,7 +298,7 @@ BOOL WINAPI W32_console_ctrl_handler(DWORD type)
cl_object
si_trap_fpe(cl_object condition, cl_object flag)
{
#if (defined(HAVE_FENV_H) && defined(HAVE_FEENABLEEXCEPT)) || defined(_MSC_VER) || defined(mingw32)
#if (defined(HAVE_FENV_H) && defined(HAVE_FEENABLEEXCEPT) && !defined(ECL_AVOID_FENV_H)) || defined(_MSC_VER) || defined(mingw32)
static int last_bits = 0;
int bits = 0;
if (condition == @'division-by-zero')

18
src/configure vendored
View file

@ -786,6 +786,7 @@ with_defsystem
with_cmp
with_rt
with_profile
with_fpe
enable_unicode
enable_longdouble
enable_c99complex
@ -1488,6 +1489,7 @@ Optional Packages:
--with-rt include MIT-RT testing environment (default=YES)
--with-profile include CMUCL's simple profiler (default=YES if
Boehm-Weiser garbage collector used)
--with-fpe detect floating point exceptions (default=YES)
--with-x use the X Window System
Some influential environment variables:
@ -2215,6 +2217,15 @@ else
fi
# Check whether --with-fpe was given.
if test "${with_fpe+set}" = set; then
withval=$with_fpe;
else
with_fpe=yes
fi
# Check whether --enable-unicode was given.
if test "${enable_unicode+set}" = set; then
enableval=$enable_unicode;
@ -5170,6 +5181,13 @@ fi
if test "${with_fpe}" != yes; then
cat >>confdefs.h <<\_ACEOF
#define ECL_AVOID_FPE_H 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking for X" >&5

View file

@ -171,6 +171,12 @@ AC_ARG_WITH(profile,
[(default=YES if Boehm-Weiser garbage collector used)]),
[], [with_profile=yes])
AC_ARG_WITH(fpe,
AS_HELP_STRING( [--with-fpe],
[detect floating point exceptions]
[(default=YES)]),
[], [with_fpe=yes])
AC_ARG_ENABLE(unicode,
AS_HELP_STRING( [--enable-unicode],
[enable support for unicode (default=NO)]),
@ -414,6 +420,12 @@ AC_SUBST(SONAME1)
AC_SUBST(SONAME)
AC_SUBST(SONAME_LDFLAGS)
dnl ----------------------------------------------------------------------
dnl Deactivate floating point exceptions if asked to
if test "${with_fpe}" != yes; then
AC_DEFINE(ECL_AVOID_FPE_H)
fi
dnl =====================================================================
dnl Checks for header files

View file

@ -266,6 +266,8 @@ typedef unsigned @CL_FIXNUM_TYPE@ cl_hashkey;
#undef HAVE_FENV_H
/* can activate individual traps in floating point environment */
#undef HAVE_FEENABLEEXCEPT
/* do we want to deactivate all support for floating point exceptions */
#undef ECL_AVOID_FPE_H
/* has support for large files */
#undef HAVE_FSEEKO
/* the tzset() function gets the current time zone */
@ -380,7 +382,11 @@ typedef unsigned @CL_FIXNUM_TYPE@ cl_hashkey;
#define ECL_ARCHITECTURE "@ARCHITECTURE@"
#include "@ECL_FPE_CODE@"
#ifdef ECL_AVOID_FPE_H
# define ecl_detect_fpe()
#else
# include "@ECL_FPE_CODE@"
#endif
#if defined(ECL_THREADS)
# if defined(darwin) || defined(freebsd) || defined(gnu)