[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
truncl on OSF/1 4.0
From: |
Bruno Haible |
Subject: |
truncl on OSF/1 4.0 |
Date: |
Sun, 13 Apr 2008 20:43:34 +0200 |
User-agent: |
KMail/1.5.4 |
On OSF/1 4.0d (but not on OSF/1 5.1) the 'truncl' test fails:
/bin/ksh: 3488 Memory fault(coredump)
FAIL: test-truncl
The reason is that the system truncl function exists and is declared, but is
completely broken:
$ cat foo.c
#include <math.h>
int main ()
{
truncl (0.0l);
return 0;
}
$ cc foo.c -lm
$ ./a.out
Segmentation fault (core dumped)
This fixes it by activating the gnulib replacement.
2008-04-13 Bruno Haible <address@hidden>
Make truncl work on OSF/1 4.0.
* m4/truncl.m4 (gl_FUNC_TRUNCL): Test whether truncl actually works.
Set REPLACE_TRUNCL, not HAVE_DECL_TRUNCL.
* lib/math.in.h (truncl): Test REPLACE_TRUNCL, not HAVE_DECL_TRUNCL.
* m4/math_h.m4 (gl_MATH_H_DEFAULTS): Initialize REPLACE_TRUNCL, not
HAVE_DECL_TRUNCL.
* modules/math (Makefile.am): Substitute REPLACE_TRUNCL, not
HAVE_DECL_TRUNCL.
* doc/posix-functions/truncl.texi: Document the OSF/1 4.0 problem.
*** doc/posix-functions/truncl.texi.orig 2008-04-13 20:40:47.000000000
+0200
--- doc/posix-functions/truncl.texi 2008-04-13 20:02:00.000000000 +0200
***************
*** 11,16 ****
--- 11,19 ----
@item
This function is missing on some platforms:
FreeBSD 5.2.1, NetBSD 3.0, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, Solaris
9, Cygwin, Interix 3.5, BeOS.
+ @item
+ This function crashes on some platforms:
+ OSF/1 4.0.
@end itemize
Portability problems not fixed by Gnulib:
*** lib/math.in.h.orig 2008-04-13 20:40:47.000000000 +0200
--- lib/math.in.h 2008-04-13 19:59:55.000000000 +0200
***************
*** 351,357 ****
#endif
#if @GNULIB_TRUNCL@
! # if address@hidden@
# define truncl rpl_truncl
extern long double truncl (long double x);
# endif
--- 351,358 ----
#endif
#if @GNULIB_TRUNCL@
! # if @REPLACE_TRUNCL@
! # undef truncl
# define truncl rpl_truncl
extern long double truncl (long double x);
# endif
*** m4/math_h.m4.orig 2008-04-13 20:40:47.000000000 +0200
--- m4/math_h.m4 2008-04-13 20:40:40.000000000 +0200
***************
*** 1,4 ****
! # math_h.m4 serial 11
dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # math_h.m4 serial 12
dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 74,80 ****
HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC])
HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF])
- HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL])
REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF])
REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL])
REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF])
--- 74,79 ----
***************
*** 90,93 ****
--- 89,93 ----
REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL])
REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT])
REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC])
+ REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL])
])
*** m4/truncl.m4.orig 2008-04-13 20:40:47.000000000 +0200
--- m4/truncl.m4 2008-04-13 20:07:49.000000000 +0200
***************
*** 1,5 ****
! # truncl.m4 serial 1
! dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
--- 1,5 ----
! # truncl.m4 serial 2
! dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
***************
*** 7,12 ****
--- 7,13 ----
AC_DEFUN([gl_FUNC_TRUNCL],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
dnl Persuade glibc <math.h> to declare truncl().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
dnl Test whether truncl() is declared.
***************
*** 38,48 ****
if test "$TRUNCL_LIBM" = "?"; then
TRUNCL_LIBM=
fi
else
! HAVE_DECL_TRUNCL=0
AC_LIBOBJ([truncl])
TRUNCL_LIBM=
fi
! AC_SUBST([HAVE_DECL_TRUNCL])
AC_SUBST([TRUNCL_LIBM])
])
--- 39,72 ----
if test "$TRUNCL_LIBM" = "?"; then
TRUNCL_LIBM=
fi
+ dnl Test whether truncl() works. It crashes on OSF/1 4.0d.
+ AC_CACHE_CHECK([whether truncl works], [gl_cv_func_truncl_works],
+ [
+ AC_TRY_RUN([
+ #include <math.h>
+ long double x;
+ int main()
+ {
+ x = truncl (0.0L);
+ return 0;
+ }], [gl_cv_func_truncl_works=yes], [gl_cv_func_truncl_works=no],
+ [case "$host_os" in
+ osf4*) gl_cv_func_truncl_works="guessing no";;
+ *) gl_cv_func_truncl_works="guessing yes";;
+ esac
+ ])
+ ])
+ case "$gl_cv_func_truncl_works" in
+ *yes) ;;
+ *) REPLACE_TRUNCL=1 ;;
+ esac
else
! REPLACE_TRUNCL=1
! fi
! if test $REPLACE_TRUNCL = 1; then
AC_LIBOBJ([truncl])
TRUNCL_LIBM=
fi
! AC_SUBST([REPLACE_TRUNCL])
AC_SUBST([TRUNCL_LIBM])
])
*** modules/math.orig 2008-04-13 20:40:47.000000000 +0200
--- modules/math 2008-04-13 20:01:04.000000000 +0200
***************
*** 51,57 ****
-e 's|@''HAVE_DECL_TANL''@|$(HAVE_DECL_TANL)|g' \
-e 's|@''HAVE_DECL_TRUNC''@|$(HAVE_DECL_TRUNC)|g' \
-e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
- -e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
-e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
-e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
-e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
--- 51,56 ----
***************
*** 67,72 ****
--- 66,72 ----
-e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \
-e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
-e
's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
+ -e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
-e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
< $(srcdir)/math.in.h; \
} > address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- truncl on OSF/1 4.0,
Bruno Haible <=