about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--BUGS39
-rw-r--r--ChangeLog71
-rw-r--r--Makeconfig9
-rw-r--r--math/Makefile14
-rw-r--r--math/libm-test.c122
-rw-r--r--math/test-double.c4
-rw-r--r--math/test-float.c4
-rw-r--r--math/test-longdouble.c4
-rw-r--r--setjmp/setjmp.h6
-rw-r--r--setjmp/tst-setjmp.c35
-rw-r--r--stdlib/strtod.c25
-rw-r--r--sysdeps/i386/__longjmp.S28
-rw-r--r--sysdeps/i386/bsd-_setjmp.S42
-rw-r--r--sysdeps/i386/bsd-setjmp.S42
-rw-r--r--sysdeps/libm-i387/e_pow.S2
-rw-r--r--sysdeps/libm-i387/e_powf.S2
-rw-r--r--sysdeps/libm-i387/s_expm1.S8
-rw-r--r--sysdeps/libm-i387/s_expm1f.S8
-rw-r--r--sysdeps/libm-i387/s_expm1l.S8
-rw-r--r--sysdeps/libm-ieee754/s_modf.c10
-rw-r--r--sysdeps/libm-ieee754/s_modff.c8
-rw-r--r--sysdeps/libm-ieee754/s_modfl.c19
-rw-r--r--sysdeps/libm-ieee754/s_tanh.c6
-rw-r--r--sysdeps/libm-ieee754/s_tanhf.c6
-rw-r--r--sysdeps/libm-ieee754/s_tanhl.c7
-rw-r--r--sysdeps/unix/bsd/osf/.cvsignore1
-rw-r--r--sysdeps/unix/sysv/linux/fxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/lxstat.c2
-rw-r--r--sysdeps/unix/sysv/linux/readv.c15
-rw-r--r--sysdeps/unix/sysv/linux/socketbits.h9
-rw-r--r--sysdeps/unix/sysv/linux/writev.c15
-rw-r--r--sysdeps/unix/sysv/linux/xstat.c2
32 files changed, 393 insertions, 182 deletions
diff --git a/BUGS b/BUGS
new file mode 100644
index 0000000000..5b839a0d0a
--- /dev/null
+++ b/BUGS
@@ -0,0 +1,39 @@
+	    List of known bugs (certainly very incomplete)
+	    ----------------------------------------------
+
+Time-stamp: <1997-03-20T02:33:37+0100 drepper>
+
+This following list contains those bugs which I'm aware of.  Please
+make sure that bugs you report are not listed here.  I you can fix one
+of these bugs I'll certainly be glad to receive a patch.
+
+Severity: [  *] to [***]
+
+
+[***]  Profiling currently does not work with programs using NSS.
+
+[***]  At least on Linux/Alpha, there seem to be problems with dynamically
+       loading NSS modules in certain situations.
+       [PR libc/137]
+
+[ **]  For GNU libc on Linux, there is still no solution for the UTMP
+       problem.
+       [Among others: PR libc/39]
+
+[ **]  There are problems with signal handling when using LinuxThreads.
+
+[ **]  The `cbrtl' function is inaccurate.  The algorithm used for `double'
+       and `float' is not usable.
+
+[ **]  Not really a bug, but it could lead to such:
+       The RPC code is ugly ugly ugly.  It's more or less verbatim taken
+       from Sun's code and therefore mostly lacks complete prototypes and
+       (more important) the use of `const'.  It *definitely* needs to be
+       cleaned.
+
+[  *]  The precision of the `sinhl' and/or `asinhl' function do not seem
+       to be the best.
+
+[  *]  The syslog function should print to the console if the LOG_CONS
+       flag was given.
+       [PR libc/72]
diff --git a/ChangeLog b/ChangeLog
index 3346ffbf2f..87de29fb6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,74 @@
+1997-03-20 01:49  Ulrich Drepper  <drepper@cygnus.com>
+
+	* sysdeps/libm-ieee754/s_tanhl.c (__tanhl): Correct handling of
+	-inf.
+
+	* Makeconfig: (rpath-link): Add math/ directory.
+	(math-objdir): New variable.
+	(link-extra-lib): Define to special version when
+	$(common-objpfx)!=$(objpfx) to allow libraries outside
+	$(common-objpfx) be linked to the application.
+
+	* math/Makefile: Add rules to build and run test programs.
+	* math/libm-test.c (_GNU_SOURCE): Define only if still undefined.
+	(check_equal): Correct check for error.
+	(ceil_test): Fix typo.
+	(log_test): Fix typo.
+	(floor_test): Fix typo.
+	(pow_test): Fix typos.
+	(log10_test): Allow slight incorrectness for `log10(e)'.
+	(modf_test): New functions to test `modf' et.al.
+	(hypot_test): Rewrite test completely.
+	Patch partly by Andreas Jaeger.
+	* math/test-double.h (__NO_MATH_INLINES): Define only if not
+	already defined.
+	* math/test-float.h: Likewise.
+	* math/test-logdouble.h: Likewise.
+
+	* setjmp/setjmp.h: Change references of ANSI C to ISO C.
+	* setjmp/tst-setjmp.c: Correct and extend test suite.
+	* sysdeps/i386/__longjmp.S: Update copyright.
+	* sysdeps/i386/bsd-_setjmp.S: Correct fatal bug in jump to
+	`__sigsetjmp' in PIC code.
+	* sysdeps/i386/bsd-setjmp.S: Likewise.
+
+	* sysdeps/libm-i387/e_pow.S: Correct recognition of mantissa
+	overflow.
+	* sysdeps/libm-i387/e_powf.S: Likewise.
+	* sysdeps/libm-i387/s_expm1.S: Handle x == +-0 as a special
+	case since expm1(-0) == -0.
+	* sysdeps/libm-i387/s_expm1f.S: Likewise.
+	* sysdeps/libm-i387/s_expm1l.S: Likewise.
+	* sysdeps/libm-ieee754/s_modf.c: Optimize code by avoiding unneeded
+	access to FP number.
+	* sysdeps/libm-ieee754/s_modff.c: Likewise.
+	* sysdeps/libm-ieee754/s_modfl.c: Correct former completely bogus
+	code.  It never worked correctly.
+	* sysdeps/libm-ieee754/s_tanh.c: Handle x == +-0 as a special
+	case since tanh(-0) == -0.
+	* sysdeps/libm-ieee754/s_tanhf.c: Likewise.
+
+1997-03-19 21:13  Ulrich Drepper  <drepper@cygnus.com>
+
+	* stdlib/strtod.c (STRTOL): Use wchar_t as type for `decimal' and
+	`thousands' to support systems with sizeof(wchar_t) !=
+	sizeof(wint_t).  Blargh.
+
+	* sysdeps/unix/sysv/linux/socketbits.h: Remove definition of
+	SOL_IP, SOL_TCP, SOL_UDP, and SOL_IPX as they are defined in
+	appropriate headers.
+
+	* sysdeps/unix/sysv/linux/writev.c: Don't use MAX_IOVEC.  Test for
+	UIO_FASTIOV and set to 8 if not available.
+	* sysdeps/unix/sysv/linux/readv.c: Likewise.
+	Patch by HJ Lu.
+
+	* sysdeps/unix/sysv/linux/xstat.c: Include <kernel_stat.h>, not
+	"kernel_stat.h".
+	* sysdeps/unix/sysv/linux/lxstat.c: Likewise.
+	* sysdeps/unix/sysv/linux/fxstat.c: Likewise.
+	Reported by fabsoft@fabsoft2.zarm.uni-bremen.de.
+
 1997-03-19 01:40  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/unix/sysv/sco3.2.4/Dist: New file.
diff --git a/Makeconfig b/Makeconfig
index cd0e4799a1..10bca6018a 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -347,7 +347,8 @@ else
 default-rpath = $(libdir)
 endif
 # This is how to find at build-time things that will be installed there.
-rpath-link = $(common-objdir):$(elfobjdir):$(nssobjdir)
+rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir)
+mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math)
 elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
 nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
 else
@@ -356,7 +357,13 @@ endif
 endif
 ifndef link-extra-libs
 ifeq (yes,$(build-shared))
+ifneq ($(common-objpfx),$(objpfx))
+link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),\
+	$(wildcard $(common-objpfx)$(lib).so$($(notdir $(lib)).so-version) \
+		   $(objpfx)$(lib).so$($(notdir $(lib)).so-version)))
+else
 link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).so$($(notdir $(lib)).so-version))
+endif
 else
 link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).a)
 endif
diff --git a/math/Makefile b/math/Makefile
index c4ed312c2b..5b1f090b5f 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -64,6 +64,20 @@ routines = $(calls) $(calls:=f) $(long-c-$(long-double-fcts))
 long-c-yes = $(calls:=l)
 distribute += $(long-c-yes:=.c)
 
+# Rules for the test suite.
+tests = test-float test-double $(test-longdouble-$(long-double-fcts))
+# We do the `long double' tests only if this data type is available and
+# distrinct from `double'.
+#
+# XXX This test is disabled for now since the functions are too buggy.
+#test-longdouble-yes = test-longdouble
+
+LDLIBS-test-float = libm
+LDLIBS-test-double = libm
+LDLIBS-test-longdouble = libm
+
+distribute += libm-test.c
+
 
 # The -lieee module sets the _LIB_VERSION_ switch to IEEE mode
 # for error handling in the -lm functions.
diff --git a/math/libm-test.c b/math/libm-test.c
index 98e3cbad5d..a0482df758 100644
--- a/math/libm-test.c
+++ b/math/libm-test.c
@@ -41,9 +41,9 @@
 /* This program isn't finished yet.
    It has tests for acos, acosh, asin, asinh, atan, atan2, atanh,
    cbrt, ceil, cos, cosh, exp, exp2, expm1, fabs, floor, fpclassify,
-   frexp, ldexp,
-   log, log10, log1p, log2, logb,
-   pow, sin, sinh, tan, tanh, fabs, hypot.
+   frexp, hypot, ldexp,
+   log, log10, log1p, log2, logb, modf,
+   pow, sin, sinh, tan, tanh.
    Tests for the other libm-functions will come later.
 
    The routines using random variables are still under construction. I don't
@@ -66,7 +66,9 @@
    log2.  */
 #undef ISO_9X_IMPLEMENTED
 
-#define _GNU_SOURCE
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
 
 #include <math.h>
 #include <float.h>
@@ -192,7 +194,7 @@ check_equal (MATHTYPE computed, MATHTYPE supplied, MATHTYPE eps, MATHTYPE * diff
 
   *diff = FUNC(fabs) (computed - supplied);
 
-  if (*diff <= eps || signbit (computed) != signbit (supplied))
+  if (*diff <= eps && (signbit (computed) == signbit (supplied) || eps != 0.0))
     return 1;
 
   return 0;
@@ -211,7 +213,7 @@ output_result_bool (const char *test_name, int result)
     {
       if (verbose)
 	printf ("Fail: %s\n", test_name);
-      noErrors++;
+      ++noErrors;
     }
 
   fpstack_test (test_name);
@@ -592,7 +594,7 @@ ceil_test (void)
   check_isinfn ("ceil (-inf) == -inf", FUNC(ceil) (minus_infty));
 
   check ("ceil (pi) == 4", FUNC(ceil) (M_PI), 4.0);
-  check ("ceil (-pi) == -3", FUNC(ceil) (-M_PI), 3.0);
+  check ("ceil (-pi) == -3", FUNC(ceil) (-M_PI), -3.0);
 }
 
 
@@ -802,7 +804,7 @@ log_test (void)
   check_isinfp ("log (+inf) == +inf", FUNC(log) (plus_infty));
 
   check_eps ("log (e) == 1", FUNC(log) (M_E), 1, CHOOSE (0, 0, 9e-8L));
-  check ("log (1/e) == -1", FUNC(log) (1.0 / M_E), 1);
+  check ("log (1/e) == -1", FUNC(log) (1.0 / M_E), -1);
   check ("log (2) == M_LN2", FUNC(log) (2), M_LN2);
   check ("log (10) == M_LN10", FUNC(log) (10), M_LN10);
 }
@@ -828,7 +830,7 @@ log10_test (void)
   check ("log10 (100) == 2", FUNC(log10) (100.0), 2);
   check ("log10 (10000) == 4", FUNC(log10) (10000.0), 4);
   check_eps ("log10 (e) == M_LOG10E", FUNC(log10) (M_E), M_LOG10E,
-	     CHOOSE (0, 0, 9e-8));
+	     CHOOSE (9e-20, 0, 9e-8));
 }
 
 
@@ -896,6 +898,42 @@ logb_test (void)
 
 
 static void
+modf_test (void)
+{
+  MATHTYPE result, intpart;
+
+  result = FUNC(modf) (plus_infty, &intpart);
+  check ("modf (+inf, &x) returns +0", result, 0);
+  check_isinfp ("modf (+inf, &x) set x to +inf", intpart);
+
+  result = FUNC(modf) (minus_infty, &intpart);
+  check ("modf (-inf, &x) returns -0", result, minus_zero);
+  check_isinfn ("modf (-inf, &x) sets x to -inf", intpart);
+
+  result = FUNC(modf) (nan_value, &intpart);
+  check_isnan ("modf (NaN, &x) returns NaN", result);
+  check_isnan ("modf (-inf, &x) sets x to NaN", intpart);
+
+  result = FUNC(modf) (0, &intpart);
+  check ("modf (0, &x) returns 0", result, 0);
+  check ("modf (0, &x) sets x to 0", intpart, 0);
+
+  result = FUNC(modf) (minus_zero, &intpart);
+  check ("modf (-0, &x) returns -0", result, minus_zero);
+  check ("modf (-0, &x) sets x to -0", intpart, minus_zero);
+
+  result = FUNC(modf) (2.5, &intpart);
+  check ("modf (2.5, &x) returns 0.5", result, 0.5);
+  check ("modf (2.5, &x) sets x to 2", intpart, 2);
+
+  result = FUNC(modf) (-2.5, &intpart);
+  check ("modf (-2.5, &x) returns -0.5", result, -0.5);
+  check ("modf (-2.5, &x) sets x to -2", intpart, -2);
+
+}
+
+
+static void
 sin_test (void)
 {
   check ("sin (+0) == +0", FUNC(sin) (0), 0);
@@ -971,58 +1009,33 @@ floor_test (void)
   check_isinfn ("floor (-inf) == -inf", FUNC(floor) (minus_infty));
 
   check ("floor (pi) == 3", FUNC(floor) (M_PI), 3.0);
-  check ("floor (-pi) == -4", FUNC(floor) (-M_PI), 4.0);
+  check ("floor (-pi) == -4", FUNC(floor) (-M_PI), -4.0);
 }
 
 
 static void
-hypot_report (const char *test_name, MATHTYPE computed, MATHTYPE expected)
+hypot_test (void)
 {
-  MATHTYPE diff;
-  int result;
-
-  result = check_equal (computed, expected, 0, &diff);
-
-  if (result)
-    {
-      if (verbose > 2)
-	printf ("Pass: %s\n", test_name);
-    }
-  else
-    {
-      if (verbose)
-	printf ("Fail: %s\n", test_name);
-      if (verbose > 1)
-	{
-	  printf ("Result:\n");
-	  printf (" is:         %.20" PRINTF_EXPR, computed);
-	  printf (" should be:  %.20" PRINTF_EXPR, expected);
-	  printf (" difference: %.20" PRINTF_EXPR "\n", diff);
-	}
-      noErrors++;
-    }
-  fpstack_test (test_name);
-  output_result (test_name, result,
-		 computed, expected, diff, PRINT, PRINT);
-}
+  MATHTYPE a;
 
+  a = random_greater (0);
+  check_isinfp_ext ("hypot (+inf, x) == +inf", FUNC(hypot) (plus_infty, a), a);
+  check_isinfp_ext ("hypot (-inf, x) == +inf", FUNC(hypot) (minus_infty, a), a);
 
-static void
-hypot_test (void)
-{
-  MATHTYPE a = FUNC(hypot) (12.4L, 0.7L);
+  check_isnan ("hypot (NaN, NaN) == NaN", FUNC(hypot) (nan_value, nan_value));
 
-  hypot_report ("hypot (x,y) == hypot (y,x)", FUNC(hypot) (0.7L, 12.4L), a);
-  hypot_report ("hypot (x,y) == hypot (-x,y)", FUNC(hypot) (-12.4L, 0.7L), a);
-  hypot_report ("hypot (x,y) == hypot (-y,x)", FUNC(hypot) (-0.7L, 12.4L), a);
-  hypot_report ("hypot (x,y) == hypot (-x,-y)", FUNC(hypot) (-12.4L, -0.7L), a);
-  hypot_report ("hypot (x,y) == hypot (-y,-x)", FUNC(hypot) (-0.7L, -12.4L), a);
+  a = FUNC(hypot) (12.4L, 0.7L);
+  check ("hypot (x,y) == hypot (y,x)", FUNC(hypot) (0.7L, 12.4L), a);
+  check ("hypot (x,y) == hypot (-x,y)", FUNC(hypot) (-12.4L, 0.7L), a);
+  check ("hypot (x,y) == hypot (-y,x)", FUNC(hypot) (-0.7L, 12.4L), a);
+  check ("hypot (x,y) == hypot (-x,-y)", FUNC(hypot) (-12.4L, -0.7L), a);
+  check ("hypot (x,y) == hypot (-y,-x)", FUNC(hypot) (-0.7L, -12.4L), a);
   check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-0.7L, 0), 0.7L);
   check ("hypot (x,0) == fabs (x)", FUNC(hypot) (0.7L, 0), 0.7L);
   check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-1.0L, 0), 1.0L);
-  check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-1.0L, 0), 1.0L);
-  check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-5.7e7L, 0), 5.7e7L);
+  check ("hypot (x,0) == fabs (x)", FUNC(hypot) (1.0L, 0), 1.0L);
   check ("hypot (x,0) == fabs (x)", FUNC(hypot) (-5.7e7L, 0), 5.7e7L);
+  check ("hypot (x,0) == fabs (x)", FUNC(hypot) (5.7e7L, 0), 5.7e7L);
 }
 
 
@@ -1084,9 +1097,9 @@ pow_test (void)
   check_isinfp ("pow (-inf, 11.1) == +inf", FUNC(pow) (minus_infty, 11.1));
   check_isinfp ("pow (-inf, 1001.1) == +inf", FUNC(pow) (minus_infty, 1001.1));
 
-  check ("pow (-inf, -1) == -0", FUNC(pow) (-minus_infty, -1), minus_zero);
-  check ("pow (-inf, -11) == -0", FUNC(pow) (-minus_infty, -11), minus_zero);
-  check ("pow (-inf, -1001) == -0", FUNC(pow) (-minus_infty, -1001), minus_zero);
+  check ("pow (-inf, -1) == -0", FUNC(pow) (minus_infty, -1), minus_zero);
+  check ("pow (-inf, -11) == -0", FUNC(pow) (minus_infty, -11), minus_zero);
+  check ("pow (-inf, -1001) == -0", FUNC(pow) (minus_infty, -1001), minus_zero);
 
   check ("pow (-inf, -2) == +0", FUNC(pow) (minus_infty, -2), 0);
   check ("pow (-inf, -12) == +0", FUNC(pow) (minus_infty, -12), 0);
@@ -1189,8 +1202,8 @@ pow_test (void)
 	     FUNC(pow) (minus_infty, x), minus_zero, x);
 
   x = ((rand () % 1000000) + 1) * -2.0;	/* Get random even integer < 0 */
-  check_ext ("pow (-inf, y) == -0 for y < 0 and not an odd integer",
-	     FUNC(pow) (minus_infty, x), minus_zero, x);
+  check_ext ("pow (-inf, y) == 0 for y < 0 and not an odd integer",
+	     FUNC(pow) (minus_infty, x), 0.0, x);
 
   x = (rand () % 1000000) * 2.0 + 1;	/* Get random odd integer > 0 */
   check_ext ("pow (+0, y) == +0 for y an odd integer > 0",
@@ -1497,6 +1510,7 @@ main (int argc, char *argv[])
   log2_test ();
 #endif
   logb_test ();
+  modf_test ();
   sin_test ();
   sinh_test ();
   tan_test ();
diff --git a/math/test-double.c b/math/test-double.c
index 5f562a098f..1f4ff8e0d0 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -24,6 +24,8 @@
 #define CHOOSE(Clongdouble,Cdouble,Cfloat) Cdouble
 #define PRINTF_EXPR "e"
 
-#define __NO_MATH_INLINES
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES
+#endif
 
 #include "libm-test.c"
diff --git a/math/test-float.c b/math/test-float.c
index fa9f2bcd9c..de918a3886 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -24,6 +24,8 @@
 #define CHOOSE(Clongdouble,Cdouble,Cfloat) Cfloat
 #define PRINTF_EXPR "e"
 
-#define __NO_MATH_INLINES
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES
+#endif
 
 #include "libm-test.c"
diff --git a/math/test-longdouble.c b/math/test-longdouble.c
index 9eebe5a5e9..eb9b57ae96 100644
--- a/math/test-longdouble.c
+++ b/math/test-longdouble.c
@@ -24,6 +24,8 @@
 #define CHOOSE(Clongdouble,Cdouble,Cfloat) Clongdouble
 #define PRINTF_EXPR "Le"
 
-#define __NO_MATH_INLINES
+#ifndef __NO_MATH_INLINES
+# define __NO_MATH_INLINES
+#endif
 
 #include "libm-test.c"
diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h
index 75abb18c6d..eb4305f5bd 100644
--- a/setjmp/setjmp.h
+++ b/setjmp/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -51,7 +51,7 @@ extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
 #ifndef	__FAVOR_BSD
 /* Set ENV to the current position and return 0, not saving the signal mask.
    This is just like `sigsetjmp (ENV, 0)'.
-   The ANSI C standard says `setjmp' is a macro.  */
+   The ISO C standard says `setjmp' is a macro.  */
 #define	setjmp(env)	__sigsetjmp ((env), 0)
 #else
 /* We are in 4.3 BSD-compatibility mode in which `setjmp'
@@ -61,7 +61,7 @@ extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
 
 #ifdef __USE_BSD
 /* Set ENV to the current position and return 0, not saving the signal mask.
-   This is the 4.3 BSD name for ANSI `setjmp'.  */
+   This is the 4.3 BSD name for ISO `setjmp'.  */
 #define _setjmp(env)	__sigsetjmp ((env), 0)
 #endif
 
diff --git a/setjmp/tst-setjmp.c b/setjmp/tst-setjmp.c
index 6147ae9567..b4cba1177d 100644
--- a/setjmp/tst-setjmp.c
+++ b/setjmp/tst-setjmp.c
@@ -54,8 +54,14 @@ main (void)
 
   if (!lose && value == 10)
     {
-      /* Do a second test, this time without `setjmp' being a macro.  */
+      /* Do a second test, this time without `setjmp' being a macro.
+         This is not required by ISO C but we have this for compatibility.  */
 #undef setjmp
+      extern int setjmp (jmp_buf);
+
+      last_value = -1;
+      lose = 0;
+
       value = setjmp (env);
       if (value != last_value + 1)
 	{
@@ -75,6 +81,33 @@ main (void)
 	}
     }
 
+  if (!lose && value == 10)
+    {
+      /* And again for the `__setjmp' function.  */
+      extern int __setjmp (jmp_buf);
+
+      last_value = -1;
+      lose = 0;
+
+      value = __setjmp (env);
+      if (value != last_value + 1)
+	{
+	  fputs("Shouldn't have ", stdout);
+	  lose = 1;
+	}
+      last_value = value;
+      switch (value)
+	{
+	case 0:
+	  puts("Saved environment.");
+	  jump (0);
+	default:
+	  printf ("Jumped to %d.\n", value);
+	  if (value < 10)
+	    jump (value + 1);
+	}
+    }
+
   if (lose || value != 10)
     puts ("Test FAILED!");
   else
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 5d892b94cb..cff75bd4ad 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -383,15 +383,13 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   typedef unsigned int wint_t;
 #endif
   /* The radix character of the current locale.  */
-  wint_t decimal;
+  wchar_t decimal;
   /* The thousands character of the current locale.  */
-  wint_t thousands;
+  wchar_t thousands;
   /* The numeric grouping specification of the current locale,
      in the format described in <locale.h>.  */
   const char *grouping;
 
-  assert (sizeof (wchar_t) == sizeof (wint_t));
-
   if (group)
     {
       grouping = _NL_CURRENT (LC_NUMERIC, GROUPING);
@@ -400,10 +398,9 @@ INTERNAL (STRTOF) (nptr, endptr, group)
       else
 	{
 	  /* Figure out the thousands separator character.  */
-	  if (mbtowc ((wchar_t *) &thousands,
-		      _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
+	  if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
 		      strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
-	    thousands = (wint_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
+	    thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
 	  if (thousands == L'\0')
 	    grouping = NULL;
 	}
@@ -417,7 +414,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   /* Find the locale's decimal point character.  */
   if (mbtowc ((wchar_t *) &decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
 	      strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
-    decimal = (wint_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+    decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
   assert (decimal != L'\0');
 
   /* Prepare number representation.  */
@@ -445,7 +442,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   /* Return 0.0 if no legal string is found.
      No character is used even if a sign was found.  */
   if ((c < L_('0') || c > L_('9'))
-      && ((wint_t) c != decimal || cp[1] < L_('0') || cp[1] > L_('9')))
+      && ((wchar_t) c != decimal || cp[1] < L_('0') || cp[1] > L_('9')))
     {
       int matched = 0;
       /* Check for `INF' or `INFINITY'.  */
@@ -511,14 +508,14 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   start_of_digits = startp = cp;
 
   /* Ignore leading zeroes.  This helps us to avoid useless computations.  */
-  while (c == L_('0') || (thousands != L'\0' && (wint_t) c == thousands))
+  while (c == L_('0') || (thousands != L'\0' && (wchar_t) c == thousands))
     c = *++cp;
 
   /* If no other digit but a '0' is found the result is 0.0.
      Return current read pointer.  */
   if ((c < L_('0') || c > L_('9')) &&
       (base == 16 && (c < TOLOWER (L_('a')) || c > TOLOWER (L_('f')))) &&
-      (wint_t) c != decimal &&
+      (wchar_t) c != decimal &&
       (base == 16 && (cp == start_of_digits || TOLOWER (c) != L_('p'))) &&
       (base != 16 && TOLOWER (c) != L_('e')))
     {
@@ -540,7 +537,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
       if ((c >= L_('0') && c <= L_('9'))
 	  || (base == 16 && TOLOWER (c) >= L_('a') && TOLOWER (c) <= L_('f')))
 	++dig_no;
-      else if (thousands == L'\0' || (wint_t) c != thousands)
+      else if (thousands == L'\0' || (wchar_t) c != thousands)
 	/* Not a digit or separator: end of the integer part.  */
 	break;
       c = *++cp;
@@ -590,7 +587,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
 
   /* Read the fractional digits.  A special case are the 'american style'
      numbers like `16.' i.e. with decimal but without trailing digits.  */
-  if ((wint_t) c == decimal)
+  if ((wchar_t) c == decimal)
     {
       c = *++cp;
       while (c >= L_('0') && c <= L_('9') ||
@@ -693,7 +690,7 @@ INTERNAL (STRTOF) (nptr, endptr, group)
   if (lead_zero)
     {
       /* Find the decimal point */
-      while ((wint_t) *startp != decimal)
+      while ((wchar_t) *startp != decimal)
 	++startp;
       startp += lead_zero + 1;
       exponent -= base == 16 ? 4 * lead_zero : lead_zero;
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
index cb33a89de1..f6331d496d 100644
--- a/sysdeps/i386/__longjmp.S
+++ b/sysdeps/i386/__longjmp.S
@@ -1,21 +1,21 @@
 /* longjmp for i386.
-Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <sysdep.h>
 #define _ASM
diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S
index a7ee5dbc1e..47972b28d1 100644
--- a/sysdeps/i386/bsd-_setjmp.S
+++ b/sysdeps/i386/bsd-_setjmp.S
@@ -1,21 +1,21 @@
 /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  i386 version.
-Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
    We cannot do it in C because it must be a tail-call, so frame-unwinding
@@ -29,5 +29,17 @@ ENTRY (_setjmp)
 	pushl $0		/* Push second argument of zero.  */
 	pushl %ecx		/* Push back first argument.  */
 	pushl %eax		/* Push back return PC.  */
-	jmp JUMPTARGET (C_SYMBOL_NAME (__sigsetjmp))
+#ifdef	PIC
+	/* We cannot use the PLT, because it requires that %ebx be set, but
+           we can't save and restore our caller's value.  Instead, we do an
+           indirect jump through the GOT, using for the temporary register
+           %ecx, which is call-clobbered.  */
+	call here
+here:	popl %ecx
+	addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx
+	movl C_SYMBOL_NAME(__sigsetjmp@GOT)(%ecx), %ecx
+	jmp *%ecx
+#else
+	jmp __sigsetjmp
+#endif
 END (_setjmp)
diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S
index 239a8c41f2..411eaf1eb2 100644
--- a/sysdeps/i386/bsd-setjmp.S
+++ b/sysdeps/i386/bsd-setjmp.S
@@ -1,21 +1,21 @@
 /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  i386 version.
-Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+   Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
 
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Library General Public License for more details.
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
 
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
    We cannot do it in C because it must be a tail-call, so frame-unwinding
@@ -29,5 +29,17 @@ ENTRY (setjmp)
 	pushl $1		/* Push second argument of one.  */
 	pushl %ecx		/* Push back first argument.  */
 	pushl %eax		/* Push back return PC.  */
-	jmp JUMPTARGET (C_SYMBOL_NAME (__sigsetjmp))
+#ifdef	PIC
+	/* We cannot use the PLT, because it requires that %ebx be set, but
+           we can't save and restore our caller's value.  Instead, we do an
+           indirect jump through the GOT, using for the temporary register
+           %ecx, which is call-clobbered.  */
+	call here
+here:	popl %ecx
+	addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx
+	movl C_SYMBOL_NAME(__sigsetjmp@GOT)(%ecx), %ecx
+	jmp *%ecx
+#else
+	jmp __sigsetjmp
+#endif
 END (setjmp)
diff --git a/sysdeps/libm-i387/e_pow.S b/sysdeps/libm-i387/e_pow.S
index ab6b454339..e665326438 100644
--- a/sysdeps/libm-i387/e_pow.S
+++ b/sysdeps/libm-i387/e_pow.S
@@ -308,7 +308,7 @@ ENTRY(__ieee754_pow)
 	andb	$1, %al
 	jz	24f		// jump if not odd
 	cmpl	$0xffe00000, %edx
-	jbe	24f		// does not fit in mantissa bits
+	jae	24f		// does not fit in mantissa bits
 	// It's an odd integer.
 	fldl	MO(mzero)
 	ret
diff --git a/sysdeps/libm-i387/e_powf.S b/sysdeps/libm-i387/e_powf.S
index 48316464ef..102cd4e3af 100644
--- a/sysdeps/libm-i387/e_powf.S
+++ b/sysdeps/libm-i387/e_powf.S
@@ -300,7 +300,7 @@ ENTRY(__ieee754_powf)
 	testb	$1, %dl
 	jz	24f		// jump if not odd
 	cmpl	$0xff000000, %edx
-	jbe	24f		// does not fit in mantissa bits
+	jae	24f		// does not fit in mantissa bits
 	// It's an odd integer.
 	fldl	MO(mzero)
 	ret
diff --git a/sysdeps/libm-i387/s_expm1.S b/sysdeps/libm-i387/s_expm1.S
index e1b198d604..92beaf0776 100644
--- a/sysdeps/libm-i387/s_expm1.S
+++ b/sysdeps/libm-i387/s_expm1.S
@@ -51,15 +51,17 @@ ENTRY(__expm1)
 	fldl	4(%esp)		// x
 	fxam			// Is NaN or +-Inf?
 	fstsw	%ax
+	movb	$0x45, %ch
+	andb	%ah, %ch
+	cmpb	$0x40, %ch
+	je	3f		// If +-0, jump.
 #ifdef	PIC
 	call	1f
 1:	popl	%edx
 	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
 #endif
-	movb	$0x45, %ch
-	andb	%ah, %ch
 	cmpb	$0x05, %ch
-	je	2f		// Is +-Inf, jump.
+	je	2f		// If +-Inf, jump.
 
 	fldt	MO(l2e)		// log2(e) : x
 	fmulp			// log2(e)*x
diff --git a/sysdeps/libm-i387/s_expm1f.S b/sysdeps/libm-i387/s_expm1f.S
index 8626fee45d..45a60fe010 100644
--- a/sysdeps/libm-i387/s_expm1f.S
+++ b/sysdeps/libm-i387/s_expm1f.S
@@ -51,15 +51,17 @@ ENTRY(__expm1f)
 	flds	4(%esp)		// x
 	fxam			// Is NaN or +-Inf?
 	fstsw	%ax
+	movb	$0x45, %ch
+	andb	%ah, %ch
+	cmpb	$0x40, %ch
+	je	3f		// If +-0, jump.
 #ifdef	PIC
 	call	1f
 1:	popl	%edx
 	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
 #endif
-	movb	$0x45, %ch
-	andb	%ah, %ch
 	cmpb	$0x05, %ch
-	je	2f		// Is +-Inf, jump.
+	je	2f		// If +-Inf, jump.
 
 	fldt	MO(l2e)		// log2(e) : x
 	fmulp			// log2(e)*x
diff --git a/sysdeps/libm-i387/s_expm1l.S b/sysdeps/libm-i387/s_expm1l.S
index 46290ca4a9..13fa698cc7 100644
--- a/sysdeps/libm-i387/s_expm1l.S
+++ b/sysdeps/libm-i387/s_expm1l.S
@@ -51,15 +51,17 @@ ENTRY(__expm1l)
 	fldt	4(%esp)		// x
 	fxam			// Is NaN or +-Inf?
 	fstsw	%ax
+	movb	$0x45, %ch
+	andb	%ah, %ch
+	cmpb	$0x40, %ch
+	je	3f		// If +-0, jump.
 #ifdef	PIC
 	call	1f
 1:	popl	%edx
 	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
 #endif
-	movb	$0x45, %ch
-	andb	%ah, %ch
 	cmpb	$0x05, %ch
-	je	2f		// Is +-Inf, jump.
+	je	2f		// If +-Inf, jump.
 
 	fldt	MO(l2e)		// log2(e) : x
 	fmulp			// log2(e)*x
diff --git a/sysdeps/libm-ieee754/s_modf.c b/sysdeps/libm-ieee754/s_modf.c
index 8075c5f813..888d4f416d 100644
--- a/sysdeps/libm-ieee754/s_modf.c
+++ b/sysdeps/libm-ieee754/s_modf.c
@@ -51,10 +51,8 @@ static double one = 1.0;
 	    } else {
 		i = (0x000fffff)>>j0;
 		if(((i0&i)|i1)==0) {		/* x is integral */
-		    u_int32_t high;
 		    *iptr = x;
-		    GET_HIGH_WORD(high,x);
-		    INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
+		    INSERT_WORDS(x,i0&0x80000000,0);	/* return +-0 */
 		    return x;
 		} else {
 		    INSERT_WORDS(*iptr,i0&(~i),0);
@@ -64,8 +62,10 @@ static double one = 1.0;
 	} else if (j0>51) {		/* no fraction part */
 	    u_int32_t high;
 	    *iptr = x*one;
-	    GET_HIGH_WORD(high,x);
-	    INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
+	    /* We must handle NaNs separately.  */
+	    if (j0 == 0x400 && ((i0 & 0xfffff) | i1))
+	      return x*one;
+	    INSERT_WORDS(x,i0&0x80000000,0);	/* return +-0 */
 	    return x;
 	} else {			/* fraction part in low x */
 	    i = ((u_int32_t)(0xffffffff))>>(j0-20);
diff --git a/sysdeps/libm-ieee754/s_modff.c b/sysdeps/libm-ieee754/s_modff.c
index 85f22c10e5..60f7f1ec29 100644
--- a/sysdeps/libm-ieee754/s_modff.c
+++ b/sysdeps/libm-ieee754/s_modff.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -57,8 +57,10 @@ static float one = 1.0;
 	} else {			/* no fraction part */
 	    u_int32_t ix;
 	    *iptr = x*one;
-	    GET_FLOAT_WORD(ix,x);
-	    SET_FLOAT_WORD(x,ix&0x80000000);	/* return +-0 */
+	    /* We must handle NaNs separately.  */
+	    if (j0 == 0x80 && (i0 & 0x7fffff))
+	      return x*one;
+	    SET_FLOAT_WORD(x,i0&0x80000000);	/* return +-0 */
 	    return x;
 	}
 }
diff --git a/sysdeps/libm-ieee754/s_modfl.c b/sysdeps/libm-ieee754/s_modfl.c
index 433c936240..324fe9fde6 100644
--- a/sysdeps/libm-ieee754/s_modfl.c
+++ b/sysdeps/libm-ieee754/s_modfl.c
@@ -55,32 +55,29 @@ static long double one = 1.0;
 	    } else {
 		i = (0xffffffff)>>j0;
 		if(((i0&i)|i1)==0) {		/* x is integral */
-		    u_int32_t high;
 		    *iptr = x;
-		    GET_HIGH_WORD(high,x);
-		    INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
+		    SET_LDOUBLE_WORDS(x,se&0x8000,0,0);	/* return +-0 */
 		    return x;
 		} else {
-		    INSERT_WORDS(*iptr,i0&(~i),0);
+		    SET_LDOUBLE_WORDS(*iptr,se,i0&(~i),0);
 		    return x - *iptr;
 		}
 	    }
 	} else if (j0>63) {		/* no fraction part */
-	    u_int32_t high;
 	    *iptr = x*one;
-	    GET_HIGH_WORD(high,x);
-	    INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
+	    /* We must handle NaNs separately.  */
+	    if (j0 == 0x4000 && ((i0 & 0x7fffffff) | i1))
+	      return x*one;
+	    SET_LDOUBLE_WORDS(x,se&0x8000,0,0);	/* return +-0 */
 	    return x;
 	} else {			/* fraction part in low x */
 	    i = ((u_int32_t)(0xffffffff))>>(j0-20);
 	    if((i1&i)==0) { 		/* x is integral */
-	        u_int32_t high;
 		*iptr = x;
-		GET_HIGH_WORD(high,x);
-		INSERT_WORDS(x,high&0x80000000,0);	/* return +-0 */
+		INSERT_WORDS(x,se&0x8000,0);	/* return +-0 */
 		return x;
 	    } else {
-	        INSERT_WORDS(*iptr,i0,i1&(~i));
+		SET_LDOUBLE_WORDS(*iptr,se,i0,i1&(~i));
 		return x - *iptr;
 	    }
 	}
diff --git a/sysdeps/libm-ieee754/s_tanh.c b/sysdeps/libm-ieee754/s_tanh.c
index 208b459b35..944f96386f 100644
--- a/sysdeps/libm-ieee754/s_tanh.c
+++ b/sysdeps/libm-ieee754/s_tanh.c
@@ -55,10 +55,10 @@ static double one=1.0, two=2.0, tiny = 1.0e-300;
 #endif
 {
 	double t,z;
-	int32_t jx,ix;
+	int32_t jx,ix,lx;
 
     /* High word of |x|. */
-	GET_HIGH_WORD(jx,x);
+	EXTRACT_WORDS(jx,lx,x);
 	ix = jx&0x7fffffff;
 
     /* x is INF or NaN */
@@ -69,6 +69,8 @@ static double one=1.0, two=2.0, tiny = 1.0e-300;
 
     /* |x| < 22 */
 	if (ix < 0x40360000) {		/* |x|<22 */
+	    if ((ix | lx) == 0)
+		return x;		/* x == +-0 */
 	    if (ix<0x3c800000) 		/* |x|<2**-55 */
 		return x*(one+x);    	/* tanh(small) = small */
 	    if (ix>=0x3ff00000) {	/* |x|>=1  */
diff --git a/sysdeps/libm-ieee754/s_tanhf.c b/sysdeps/libm-ieee754/s_tanhf.c
index b989ef3565..2a0ca9f3df 100644
--- a/sysdeps/libm-ieee754/s_tanhf.c
+++ b/sysdeps/libm-ieee754/s_tanhf.c
@@ -8,7 +8,7 @@
  *
  * Developed at SunPro, a Sun Microsystems, Inc. business.
  * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice 
+ * software is freely granted, provided that this notice
  * is preserved.
  * ====================================================
  */
@@ -40,13 +40,15 @@ static float one=1.0, two=2.0, tiny = 1.0e-30;
 	ix = jx&0x7fffffff;
 
     /* x is INF or NaN */
-	if(ix>=0x7f800000) { 
+	if(ix>=0x7f800000) {
 	    if (jx>=0) return one/x+one;    /* tanh(+-inf)=+-1 */
 	    else       return one/x-one;    /* tanh(NaN) = NaN */
 	}
 
     /* |x| < 22 */
 	if (ix < 0x41b00000) {		/* |x|<22 */
+	    if (ix == 0)
+		return x;		/* x == +-0 */
 	    if (ix<0x24000000) 		/* |x|<2**-55 */
 		return x*(one+x);    	/* tanh(small) = small */
 	    if (ix>=0x3f800000) {	/* |x|>=1  */
diff --git a/sysdeps/libm-ieee754/s_tanhl.c b/sysdeps/libm-ieee754/s_tanhl.c
index f7ea3f4216..1e3dc3b613 100644
--- a/sysdeps/libm-ieee754/s_tanhl.c
+++ b/sysdeps/libm-ieee754/s_tanhl.c
@@ -68,12 +68,15 @@ static long double one=1.0, two=2.0, tiny = 1.0e-4900L;
 
     /* x is INF or NaN */
 	if(ix==0x7fff) {
-	    if (se>=0x7fff) return one/x+one;    /* tanhl(+-inf)=+-1 */
-	    else            return one/x-one;    /* tanhl(NaN) = NaN */
+	    /* for NaN it's not important which branch: tanhl(NaN) = NaN */
+	    if (se&0x8000) return one/x-one;	/* tanhl(-inf)= -1; */
+	    else           return one/x+one;	/* tanhl(+inf)=+1 */
 	}
 
     /* |x| < 23 */
 	if (ix < 0x4003 || (ix == 0x4003 && j0 < 0xb8000000u)) {/* |x|<23 */
+	    if ((ix|j0|j1) == 0)
+		return x;		/* x == +- 0 */
 	    if (ix<0x3fc8) 		/* |x|<2**-55 */
 		return x*(one+x);    	/* tanh(small) = small */
 	    if (ix>=0x3fff) {	/* |x|>=1  */
diff --git a/sysdeps/unix/bsd/osf/.cvsignore b/sysdeps/unix/bsd/osf/.cvsignore
new file mode 100644
index 0000000000..c9147fd335
--- /dev/null
+++ b/sysdeps/unix/bsd/osf/.cvsignore
@@ -0,0 +1 @@
+=*
diff --git a/sysdeps/unix/sysv/linux/fxstat.c b/sysdeps/unix/sysv/linux/fxstat.c
index 103218711b..5aa02dcac8 100644
--- a/sysdeps/unix/sysv/linux/fxstat.c
+++ b/sysdeps/unix/sysv/linux/fxstat.c
@@ -21,7 +21,7 @@
 #include <stddef.h>
 #include <sys/stat.h>
 
-#include "kernel_stat.h"
+#include <kernel_stat.h>
 
 extern int __syscall_fstat (int, struct kernel_stat *);
 
diff --git a/sysdeps/unix/sysv/linux/lxstat.c b/sysdeps/unix/sysv/linux/lxstat.c
index 713490cf66..11c9038646 100644
--- a/sysdeps/unix/sysv/linux/lxstat.c
+++ b/sysdeps/unix/sysv/linux/lxstat.c
@@ -21,7 +21,7 @@
 #include <stddef.h>
 #include <sys/stat.h>
 
-#include "kernel_stat.h"
+#include <kernel_stat.h>
 
 extern int __syscall_lstat (const char *, struct kernel_stat *);
 
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index 458e8ffb38..c8ff55ab45 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -26,15 +26,12 @@ extern ssize_t __syscall_readv __P ((int, __const struct iovec *, int));
 
 
 /* Not all versions of the kernel support the large number of records.  */
-#undef MAX_IOVEC
-#ifdef UIO_FASTIOV
-# define MAX_IOVEC	UIO_FASTIOV
-#else
-# define MAX_IOVEC	8	/* 8 is a safe number. */
+#ifndef UIO_FASTIOV
+# define UIO_FASTIOV	8	/* 8 is a safe number.  */
 #endif
 
 
-/* We should deal with kernel which have a smaller UIO_MAXIOV as well
+/* We should deal with kernel which have a smaller UIO_FASTIOV as well
    as a very big count.  */
 ssize_t
 readv (fd, vector, count)
@@ -47,7 +44,7 @@ readv (fd, vector, count)
 
   bytes_read = __syscall_readv (fd, vector, count);
 
-  if (bytes_read < 0 && errno == EINVAL && count > MAX_IOVEC)
+  if (bytes_read < 0 && errno == EINVAL && count > UIO_FASTIOV)
     {
       int i;
 
@@ -55,10 +52,10 @@ readv (fd, vector, count)
       __set_errno (errno_saved);
 
       bytes_read = 0;
-      for (i = 0; i < count; i += MAX_IOVEC)
+      for (i = 0; i < count; i += UIO_FASTIOV)
 	{
 	  ssize_t bytes = __syscall_readv (fd, vector + i,
-					   MIN (count - i, MAX_IOVEC));
+					   MIN (count - i, UIO_FASTIOV));
 
 	  if (bytes < 0)
 	    return bytes;
diff --git a/sysdeps/unix/sysv/linux/socketbits.h b/sysdeps/unix/sysv/linux/socketbits.h
index 166971a384..101afc268c 100644
--- a/sysdeps/unix/sysv/linux/socketbits.h
+++ b/sysdeps/unix/sysv/linux/socketbits.h
@@ -83,14 +83,13 @@ enum __socket_type
 #define	AF_INET6	PF_INET6
 #define	AF_MAX		PF_MAX
 
-/* Socket level values.  */
-#define SOL_IP          0
-#define SOL_TCP         6
-#define SOL_UDP         17
+/* Socket level values.  Others are defined in the appropriate headers.
+
+   XXX These definitions also should go into the appropriate headers as
+   far as they are available.  */
 #define SOL_IPV6        41
 #define SOL_ICMPV6      58
 #define SOL_RAW		255
-#define SOL_IPX         256
 #define SOL_AX25        257
 #define SOL_ATALK       258
 #define SOL_NETROM      259
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index 11afd81d2e..d147186b51 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -25,15 +25,12 @@
 extern ssize_t __syscall_writev __P ((int, const struct iovec *, int));
 
 /* Not all versions of the kernel support the large number of records.  */
-#undef MAX_IOVEC
-#ifdef UIO_FASTIOV
-# define MAX_IOVEC	UIO_FASTIOV
-#else
-# define MAX_IOVEC	8	/* 8 is a safe number. */
+#ifndef UIO_FASTIOV
+# define UIO_FASTIOV	8	/* 8 is a safe number.  */
 #endif
 
 
-/* We should deal with kernel which have a smaller UIO_MAXIOV as well
+/* We should deal with kernel which have a smaller UIO_FASTIOV as well
    as a very big count.  */
 ssize_t
 writev (fd, vector, count)
@@ -46,7 +43,7 @@ writev (fd, vector, count)
 
   bytes_written = __syscall_writev (fd, vector, count);
 
-  if (bytes_written < 0 && errno == EINVAL && count > MAX_IOVEC)
+  if (bytes_written < 0 && errno == EINVAL && count > UIO_FASTIOV)
     {
       int i;
 
@@ -54,10 +51,10 @@ writev (fd, vector, count)
       __set_errno (errno_saved);
 
       bytes_written = 0;
-      for (i = 0; i < count; i += MAX_IOVEC)
+      for (i = 0; i < count; i += UIO_FASTIOV)
 	{
 	  ssize_t bytes = __syscall_writev (fd, vector + i,
-					    MIN (count - i, MAX_IOVEC));
+					    MIN (count - i, UIO_FASTIOV));
 
 	  if (bytes < 0)
 	    return bytes_written > 0 ? bytes_written : bytes;
diff --git a/sysdeps/unix/sysv/linux/xstat.c b/sysdeps/unix/sysv/linux/xstat.c
index be49b9d1de..aa120f5193 100644
--- a/sysdeps/unix/sysv/linux/xstat.c
+++ b/sysdeps/unix/sysv/linux/xstat.c
@@ -21,7 +21,7 @@
 #include <stddef.h>
 #include <sys/stat.h>
 
-#include "kernel_stat.h"
+#include <kernel_stat.h>
 
 extern int __syscall_stat (const char *, struct kernel_stat *);