[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r2163 - in /trunk: libc/ libc/malloc/ libc/math/ libc/resolv/ libc/soft-fp/ libc/stdio-common/ libc/sysdeps/posix/ ports/ po...



Author: joseph
Date: Fri May  4 04:15:57 2007
New Revision: 2163

Log:
Merge changes between r2107 and r2162 from /fsf/trunk.

Added:
    trunk/libc/resolv/tst-inet_ntop.c
      - copied unchanged from r2162, fsf/trunk/libc/resolv/tst-inet_ntop.c
Modified:
    trunk/libc/ChangeLog
    trunk/libc/malloc/malloc.c
    trunk/libc/math/test-misc.c
    trunk/libc/resolv/Makefile
    trunk/libc/resolv/inet_ntop.c
    trunk/libc/soft-fp/extended.h
    trunk/libc/soft-fp/floatundidf.c
    trunk/libc/soft-fp/floatundisf.c
    trunk/libc/soft-fp/floatunsidf.c
    trunk/libc/soft-fp/floatunsisf.c
    trunk/libc/soft-fp/op-2.h
    trunk/libc/soft-fp/op-4.h
    trunk/libc/soft-fp/op-common.h
    trunk/libc/stdio-common/printf_fp.c
    trunk/libc/stdio-common/test-vfprintf.c
    trunk/libc/stdio-common/tfformat.c
    trunk/libc/stdio-common/vfprintf.c
    trunk/libc/sysdeps/posix/getaddrinfo.c
    trunk/ports/ChangeLog.hppa
    trunk/ports/sysdeps/unix/sysv/linux/hppa/linuxthreads/bits/pthreadtypes.h

Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Fri May  4 04:15:57 2007
@@ -1,3 +1,94 @@
+2007-05-03  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* soft-fp/op-common.h (FP_TRUNC): Replace raising of FP_EX_INEXACT
+	with setting the sticky bit.
+	* math/test-misc.c (main): Add more truncation tests.
+
+2007-04-14  Uros Bizjak  <ubizjak@xxxxxxxxx>
+
+	* soft-fp/floatunsidf.c (__floatunsidf): Use DFtype instead of
+	double in the function declaration.
+	* soft-fp/floatundidf.c (__floatundidf): Use DFtype instead of
+	double in the function declaration.
+	* soft-fp/floatunsisf.c (__floatunsisf): Use SFtype instead of
+	float in the function declaration.
+	* soft-fp/floatunsisf.c (__floatunsisf): Use SFtype instead of
+	float in the function declaration.
+
+	* soft-fp/extended.h (FP_UNPACK_RAW_E): Do not increase X##_e for
+	denormal operands.  Do not generate FP_EX_DENORM exception.
+	(FP_UNPACK_RAW_EP): Ditto.
+	(FP_UNPACK_SEMIRAW_E): Use FP_UNPACK_RAW_E instead of
+	undefined _FP_UNPACK_RAW_E.
+	(FP_UNPACK_SEMIRAW_EP): Use FP_UNPACK_RAW_EP instead of
+	undefined _FP_UNPACK_RAW_EP.
+	(FP_PACK_SEMIRAW_E): Use FP_PACK_RAW_E instead of
+	undefined _FP_PACK_RAW_E.
+	(FP_PACK_SEMIRAW_EP): Use FP_PACK_RAW_EP instead of
+	undefined _FP_PACK_RAW_EP.
+
+	* op-2.h (_FP_FRAC_COPY_2_2): Define as alias to _FP_FRAC_COPY_2.
+	* op-4.h (_FP_FRAC_COPY_2_2): Define as alias to _FP_FRAC_COPY_4.
+
+2007-04-16  Uros Bizjak  <ubizjak@xxxxxxxxx>
+	    Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* soft-fp/op-common.h (FP_EXTEND): Do not abort when
+	_FP_EXPBIAS_##dfs == _FP_EXPBIAS_##sfs.  Handle denormals for
+	this case.
+	* soft-fp/op-common.h (FP_TRUNC): Ditto.
+
+2007-05-03  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* math/test-misc.c (main): Add tests for rounding long double
+	values close to smallest double denormalized value to double.
+
+2007-04-30  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* soft-fp/op-common.h (FP_TRUNC): Correct off-by-one error in
+	condition for truncating to 0.  Set sticky bit for such
+	truncation.
+
+2007-05-02  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* stdio-common/vfprintf.c (process_string_arg): Use a VLA rather than
+	fixed length array for ignore.
+
+2007-04-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4438]
+	* stdio-common/vfprintf.c (process_string_arg): Don't overflow the
+	stack for large precisions.
+	* stdio-common/test-vfprintf.c (main): Add test for large
+	precision.
+
+2007-04-30  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* stdio-common/printf_fp.c (___printf_fp): Don't print negative sign
+	for exponent 0.
+	* stdio-common/tfformat.c (sprint_doubles): Add a new test.
+
+	[BZ #4439]
+	* resolv/inet_ntop.c (inet_ntop4): Take terminating '\0' into
+	account in the size check.
+	* resolv/tst-inet_ntop.c: New test.
+	* resolv/Makefile (tests): Add tst-inet_ntop.
+
+2007-04-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
+	    Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	[BZ #4349]
+	* malloc/malloc.c: Keep separate list for first blocks on the bin
+	lists with a given size.  This helps skipping over list elements
+	we know won't fit in two places.
+	Inspired by a patch by Tomash Brechko <tomash.brechko@xxxxxxxxx>.
+
+2007-04-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #4102]
+	* sysdeps/posix/getaddrinfo.c (default_labels): Assign separate
+	label to Teredo tunnel addresses 2001://32.
+
 2007-04-27  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* locale/programs/ld-collate.c (collate_read): Allow order_start

Modified: trunk/libc/malloc/malloc.c
==============================================================================
--- trunk/libc/malloc/malloc.c (original)
+++ trunk/libc/malloc/malloc.c Fri May  4 04:15:57 2007
@@ -1,5 +1,5 @@
 /* Malloc implementation for multiple threads without lock contention.
-   Copyright (C) 1996-2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wg@xxxxxxxxx>
    and Doug Lea <dl@xxxxxxxxxxxxx>, 2001.
@@ -26,10 +26,6 @@
 * Version ptmalloc2-20011215
   based on:
   VERSION 2.7.0 Sun Mar 11 14:14:06 2001  Doug Lea  (dl at gee)
-
-   Note: There may be an updated version of this malloc obtainable at
-           http://www.malloc.de/malloc/ptmalloc2.tar.gz
-         Check before installing!
 
 * Quickstart
 
@@ -1781,6 +1777,10 @@
 
   struct malloc_chunk* fd;         /* double links -- used only if free. */
   struct malloc_chunk* bk;
+
+  /* Only used for large blocks: pointer to next larger size.  */
+  struct malloc_chunk* fd_nextsize; /* double links -- used only if free. */
+  struct malloc_chunk* bk_nextsize;
 };
 
 
@@ -1881,7 +1881,7 @@
 #define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ))
 
 /* The smallest possible chunk */
-#define MIN_CHUNK_SIZE        (sizeof(struct malloc_chunk))
+#define MIN_CHUNK_SIZE        (offsetof(struct malloc_chunk, fd_nextsize))
 
 /* The smallest size we can malloc is an aligned minimal chunk */
 
@@ -2081,6 +2081,24 @@
   else {                                                               \
     FD->bk = BK;                                                       \
     BK->fd = FD;                                                       \
+    if (!in_smallbin_range (P->size)				       \
+	&& __builtin_expect (P->fd_nextsize != NULL, 0)) {	       \
+      assert (P->fd_nextsize->bk_nextsize == P);		       \
+      assert (P->bk_nextsize->fd_nextsize == P);		       \
+      if (FD->fd_nextsize == NULL) {				       \
+	if (P->fd_nextsize == P)				       \
+	  FD->fd_nextsize = FD->bk_nextsize = FD;		       \
+	else {							       \
+	  FD->fd_nextsize = P->fd_nextsize;			       \
+	  FD->bk_nextsize = P->bk_nextsize;			       \
+	  P->fd_nextsize->bk_nextsize = FD;			       \
+	  P->bk_nextsize->fd_nextsize = FD;			       \
+	}							       \
+      }	else {							       \
+	P->fd_nextsize->bk_nextsize = P->bk_nextsize;		       \
+	P->bk_nextsize->fd_nextsize = P->fd_nextsize;		       \
+      }								       \
+    }								       \
   }                                                                    \
 }
 
@@ -2797,7 +2815,31 @@
         /* lists are sorted */
         assert(p->bk == b ||
                (unsigned long)chunksize(p->bk) >= (unsigned long)chunksize(p));
-      }
+
+	if (!in_smallbin_range(size))
+	  {
+	    if (p->fd_nextsize != NULL)
+	      {
+		if (p->fd_nextsize == p)
+		  assert (p->bk_nextsize == p);
+		else
+		  {
+		    if (p->fd_nextsize == first (b))
+		      assert (chunksize (p) < chunksize (p->fd_nextsize));
+		    else
+		      assert (chunksize (p) > chunksize (p->fd_nextsize));
+
+		    if (p == first (b))
+		      assert (chunksize (p) > chunksize (p->bk_nextsize));
+		    else
+		      assert (chunksize (p) < chunksize (p->bk_nextsize));
+		  }
+	      }
+	    else
+	      assert (p->bk_nextsize == NULL);
+	  }
+      } else if (!in_smallbin_range(size))
+	assert (p->fd_nextsize == NULL && p->bk_nextsize == NULL);
       /* chunk is followed by a legal chain of inuse chunks */
       for (q = next_chunk(p);
            (q != av->top && inuse(q) &&
@@ -4149,6 +4191,11 @@
         unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
         av->last_remainder = remainder;
         remainder->bk = remainder->fd = unsorted_chunks(av);
+	if (!in_smallbin_range(remainder_size))
+	  {
+	    remainder->fd_nextsize = NULL;
+	    remainder->bk_nextsize = NULL;
+	  }
 
         set_head(victim, nb | PREV_INUSE |
 		 (av != &main_arena ? NON_MAIN_ARENA : 0));
@@ -4197,19 +4244,36 @@
           size |= PREV_INUSE;
           /* if smaller than smallest, bypass loop below */
 	  assert((bck->bk->size & NON_MAIN_ARENA) == 0);
-          if ((unsigned long)(size) <= (unsigned long)(bck->bk->size)) {
+	  if ((unsigned long)(size) < (unsigned long)(bck->bk->size)) {
             fwd = bck;
             bck = bck->bk;
+
+	    victim->fd_nextsize = fwd->fd;
+	    victim->bk_nextsize = fwd->fd->bk_nextsize;
+	    fwd->fd->bk_nextsize = victim->bk_nextsize->fd_nextsize = victim;
           }
           else {
 	    assert((fwd->size & NON_MAIN_ARENA) == 0);
-            while ((unsigned long)(size) < (unsigned long)(fwd->size)) {
-              fwd = fwd->fd;
-	      assert((fwd->size & NON_MAIN_ARENA) == 0);
-	    }
-            bck = fwd->bk;
+	    while ((unsigned long) size < fwd->size)
+	      {
+		fwd = fwd->fd_nextsize;
+		assert((fwd->size & NON_MAIN_ARENA) == 0);
+	      }
+
+	    if ((unsigned long) size == (unsigned long) fwd->size)
+	      /* Always insert in the second position.  */
+	      fwd = fwd->fd;
+	    else
+	      {
+		victim->fd_nextsize = fwd;
+		victim->bk_nextsize = fwd->bk_nextsize;
+		fwd->bk_nextsize = victim;
+		victim->bk_nextsize->fd_nextsize = victim;
+	      }
+	    bck = fwd->bk;
           }
-        }
+	} else
+	  victim->fd_nextsize = victim->bk_nextsize = victim;
       }
 
       mark_bin(av, victim_index);
@@ -4225,21 +4289,25 @@
 
     /*
       If a large request, scan through the chunks of current bin in
-      sorted order to find smallest that fits.  This is the only step
-      where an unbounded number of chunks might be scanned without doing
-      anything useful with them. However the lists tend to be short.
+      sorted order to find smallest that fits.  Use the skip list for this.
     */
 
     if (!in_smallbin_range(nb)) {
       bin = bin_at(av, idx);
 
       /* skip scan if empty or largest chunk is too small */
-      if ((victim = last(bin)) != bin &&
-          (unsigned long)(first(bin)->size) >= (unsigned long)(nb)) {
-
+      if ((victim = first(bin)) != bin &&
+          (unsigned long)(victim->size) >= (unsigned long)(nb)) {
+
+	victim = victim->bk_nextsize;
         while (((unsigned long)(size = chunksize(victim)) <
                 (unsigned long)(nb)))
-          victim = victim->bk;
+          victim = victim->bk_nextsize;
+
+	/* Avoid removing the first entry for a size so that the skip
+	   list does not have to be rerouted.  */
+	if (victim != last(bin) && victim->size == victim->fd->size)
+	  victim = victim->fd;
 
         remainder_size = size - nb;
         unlink(victim, bck, fwd);
@@ -4261,6 +4329,11 @@
 	  remainder->fd = fwd;
 	  bck->fd = remainder;
 	  fwd->bk = remainder;
+	  if (!in_smallbin_range(remainder_size))
+	    {
+	      remainder->fd_nextsize = NULL;
+	      remainder->bk_nextsize = NULL;
+	    }
           set_head(victim, nb | PREV_INUSE |
 		   (av != &main_arena ? NON_MAIN_ARENA : 0));
           set_head(remainder, remainder_size | PREV_INUSE);
@@ -4330,9 +4403,7 @@
         remainder_size = size - nb;
 
         /* unlink */
-        bck = victim->bk;
-        bin->bk = bck;
-        bck->fd = bin;
+        unlink(victim, bck, fwd);
 
         /* Exhaust */
         if (remainder_size < MINSIZE) {
@@ -4357,7 +4428,11 @@
           /* advertise as last remainder */
           if (in_smallbin_range(nb))
             av->last_remainder = remainder;
-
+	  if (!in_smallbin_range(remainder_size))
+	    {
+	      remainder->fd_nextsize = NULL;
+	      remainder->bk_nextsize = NULL;
+	    }
           set_head(victim, nb | PREV_INUSE |
 		   (av != &main_arena ? NON_MAIN_ARENA : 0));
           set_head(remainder, remainder_size | PREV_INUSE);
@@ -4580,8 +4655,13 @@
 
       bck = unsorted_chunks(av);
       fwd = bck->fd;
+      p->fd = fwd;
       p->bk = bck;
-      p->fd = fwd;
+      if (!in_smallbin_range(size))
+	{
+	  p->fd_nextsize = NULL;
+	  p->bk_nextsize = NULL;
+	}
       bck->fd = p;
       fwd->bk = p;
 
@@ -4748,6 +4828,11 @@
             first_unsorted = unsorted_bin->fd;
             unsorted_bin->fd = p;
             first_unsorted->bk = p;
+
+            if (!in_smallbin_range (size)) {
+	      p->fd_nextsize = NULL;
+	      p->bk_nextsize = NULL;
+	    }
 
             set_head(p, size | PREV_INUSE);
             p->bk = unsorted_bin;

Modified: trunk/libc/math/test-misc.c
==============================================================================
--- trunk/libc/math/test-misc.c (original)
+++ trunk/libc/math/test-misc.c Fri May  4 04:15:57 2007
@@ -1235,5 +1235,85 @@
     }
 #endif
 
+#if !defined NO_LONG_DOUBLE && LDBL_MANT_DIG >= DBL_MANT_DIG + 4
+  int oldmode = fegetround ();
+  int j;
+  for (j = 0; j < 4; j++)
+    {
+      int mode;
+      int i;
+      int k = 0;
+      const char *mstr;
+      switch (j)
+	{
+#ifdef FE_TONEAREST
+	case 0:
+	  mode = FE_TONEAREST;
+	  mstr = "nearest";
+	  k = 8;
+	  break;
+#endif
+#ifdef FE_DOWNWARD
+	case 1:
+	  mode = FE_DOWNWARD;
+	  mstr = "-inf";
+	  break;
+#endif
+#ifdef FE_UPWARD
+	case 2:
+	  mode = FE_UPWARD;
+	  mstr = "+inf";
+	  k = 15;
+	  break;
+#endif
+#ifdef FE_TOWARDZERO
+	case 3:
+	  mode = FE_TOWARDZERO;
+	  mstr = "0";
+	  break;
+#endif
+	default:
+	  continue;
+	}
+
+      volatile long double ld5 = nextafter (0.0, 1.0) / 16.0L;
+      volatile double d5;
+      (void) &ld5;
+      for (i = 0; i <= 32; i++)
+	{
+	  if (fesetround (mode))
+	    {
+	      printf ("failed to set rounding mode to %s\n", mstr);
+	      result = 1;
+	      break;
+	    }
+	  d5 = ld5 * i;
+	  (void) &d5;
+	  fesetround (oldmode);
+	  if (d5 != ((j == 0 && i == 8) ? 0 : (i + k) / 16)
+		    * nextafter (0.0, 1.0))
+	    {
+	      printf ("%La incorrectly rounded to %s as %a\n",
+		      ld5 * i, mstr, d5);
+	      result = 1;
+	    }
+	}
+    }
+
+  volatile long double ld7 = nextafterl (0.0L, 1.0L);
+  volatile double d7;
+  (void) &ld7;
+  fesetround (FE_UPWARD);
+  d7 = ld7;
+  (void) &d7;
+  fesetround (oldmode);
+
+  if (d7 != nextafter (0.0, 1.0))
+    {
+      printf ("%La incorrectly rounded upward to %a\n", ld7, d7);
+      result = 1;
+    }
+#endif
+
   return result;
 }

Modified: trunk/libc/resolv/Makefile
==============================================================================
--- trunk/libc/resolv/Makefile (original)
+++ trunk/libc/resolv/Makefile Fri May  4 04:15:57 2007
@@ -1,4 +1,4 @@
-# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2003,2004
+# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2003,2004,2007
 #	Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -32,7 +32,7 @@
 routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
 	    res_hconf res_libc res-state
 
-tests = tst-aton tst-leaks
+tests = tst-aton tst-leaks tst-inet_ntop
 xtests = tst-leaks2
 
 generate := mtrace-tst-leaks tst-leaks.mtrace tst-leaks2.mtrace

Modified: trunk/libc/resolv/inet_ntop.c
==============================================================================
--- trunk/libc/resolv/inet_ntop.c (original)
+++ trunk/libc/resolv/inet_ntop.c Fri May  4 04:15:57 2007
@@ -96,7 +96,7 @@
 	static const char fmt[] = "%u.%u.%u.%u";
 	char tmp[sizeof "255.255.255.255"];
 
-	if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
+	if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) >= size) {
 		__set_errno (ENOSPC);
 		return (NULL);
 	}

Modified: trunk/libc/soft-fp/extended.h
==============================================================================
--- trunk/libc/soft-fp/extended.h (original)
+++ trunk/libc/soft-fp/extended.h Fri May  4 04:15:57 2007
@@ -94,12 +94,6 @@
     X##_f[1] = _flo.bits.frac1;				\
     X##_e  = _flo.bits.exp;				\
     X##_s  = _flo.bits.sign;				\
-    if (!X##_e && (X##_f[1] || X##_f[0])		\
-        && !(X##_f[1] & _FP_IMPLBIT_E))			\
-      {							\
-        X##_e++;					\
-        FP_SET_EXCEPTION(FP_EX_DENORM);			\
-      }							\
   } while (0)
 
 #define FP_UNPACK_RAW_EP(X, val)			\
@@ -112,12 +106,6 @@
     X##_f[1] = _flo->bits.frac1;			\
     X##_e  = _flo->bits.exp;				\
     X##_s  = _flo->bits.sign;				\
-    if (!X##_e && (X##_f[1] || X##_f[0])		\
-        && !(X##_f[1] & _FP_IMPLBIT_E))			\
-      {							\
-        X##_e++;					\
-        FP_SET_EXCEPTION(FP_EX_DENORM);			\
-      }							\
   } while (0)
 
 #define FP_PACK_RAW_E(val, X)				\
@@ -164,13 +152,13 @@
 
 #define FP_UNPACK_SEMIRAW_E(X,val)	\
   do {					\
-    _FP_UNPACK_RAW_E(X,val);		\
+    FP_UNPACK_RAW_E(X,val);		\
     _FP_UNPACK_SEMIRAW(E,4,X);		\
   } while (0)
 
 #define FP_UNPACK_SEMIRAW_EP(X,val)	\
   do {					\
-    _FP_UNPACK_RAW_EP(X,val);		\
+    FP_UNPACK_RAW_EP(X,val);		\
     _FP_UNPACK_SEMIRAW(E,4,X);		\
   } while (0)
 
@@ -189,13 +177,13 @@
 #define FP_PACK_SEMIRAW_E(val,X)	\
   do {					\
     _FP_PACK_SEMIRAW(E,4,X);		\
-    _FP_PACK_RAW_E(val,X);		\
+    FP_PACK_RAW_E(val,X);		\
   } while (0)
 
 #define FP_PACK_SEMIRAW_EP(val,X)	\
   do {					\
     _FP_PACK_SEMIRAW(E,4,X);		\
-    _FP_PACK_RAW_EP(val,X);		\
+    FP_PACK_RAW_EP(val,X);		\
   } while (0)
 
 #define FP_ISSIGNAN_E(X)	_FP_ISSIGNAN(E,4,X)
@@ -299,11 +287,6 @@
     X##_f1 = 0;							\
     X##_e = _flo.bits.exp;					\
     X##_s = _flo.bits.sign;					\
-    if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E))		\
-      {								\
-        X##_e++;						\
-        FP_SET_EXCEPTION(FP_EX_DENORM);				\
-      }								\
   } while (0)
 
 #define FP_UNPACK_RAW_EP(X, val)				\
@@ -315,11 +298,6 @@
     X##_f1 = 0;							\
     X##_e = _flo->bits.exp;					\
     X##_s = _flo->bits.sign;					\
-    if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E))		\
-      {								\
-        X##_e++;						\
-        FP_SET_EXCEPTION(FP_EX_DENORM);				\
-      }								\
   } while (0)
 
 #define FP_PACK_RAW_E(val, X)					\
@@ -365,13 +343,13 @@
 
 #define FP_UNPACK_SEMIRAW_E(X,val)	\
   do {					\
-    _FP_UNPACK_RAW_E(X,val);		\
+    FP_UNPACK_RAW_E(X,val);		\
     _FP_UNPACK_SEMIRAW(E,2,X);		\
   } while (0)
 
 #define FP_UNPACK_SEMIRAW_EP(X,val)	\
   do {					\
-    _FP_UNPACK_RAW_EP(X,val);		\
+    FP_UNPACK_RAW_EP(X,val);		\
     _FP_UNPACK_SEMIRAW(E,2,X);		\
   } while (0)
 
@@ -390,13 +368,13 @@
 #define FP_PACK_SEMIRAW_E(val,X)	\
   do {					\
     _FP_PACK_SEMIRAW(E,2,X);		\
-    _FP_PACK_RAW_E(val,X);		\
+    FP_PACK_RAW_E(val,X);		\
   } while (0)
 
 #define FP_PACK_SEMIRAW_EP(val,X)	\
   do {					\
     _FP_PACK_SEMIRAW(E,2,X);		\
-    _FP_PACK_RAW_EP(val,X);		\
+    FP_PACK_RAW_EP(val,X);		\
   } while (0)
 
 #define FP_ISSIGNAN_E(X)	_FP_ISSIGNAN(E,2,X)

Modified: trunk/libc/soft-fp/floatundidf.c
==============================================================================
--- trunk/libc/soft-fp/floatundidf.c (original)
+++ trunk/libc/soft-fp/floatundidf.c Fri May  4 04:15:57 2007
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Convert a 64bit unsigned integer to IEEE double
-   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@xxxxxxxxxx) and
 		  Jakub Jelinek (jj@xxxxxxxxxxxxxx).
@@ -32,8 +32,7 @@
 #include "soft-fp.h"
 #include "double.h"
 
-double
-__floatundidf(UDItype i)
+DFtype __floatundidf(UDItype i)
 {
   FP_DECL_EX;
   FP_DECL_D(A);

Modified: trunk/libc/soft-fp/floatundisf.c
==============================================================================
--- trunk/libc/soft-fp/floatundisf.c (original)
+++ trunk/libc/soft-fp/floatundisf.c Fri May  4 04:15:57 2007
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Convert a 64bit unsigned integer to IEEE single
-   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@xxxxxxxxxx) and
 		  Jakub Jelinek (jj@xxxxxxxxxxxxxx).
@@ -32,8 +32,7 @@
 #include "soft-fp.h"
 #include "single.h"
 
-float
-__floatundisf(UDItype i)
+SFtype __floatundisf(UDItype i)
 {
   FP_DECL_EX;
   FP_DECL_S(A);

Modified: trunk/libc/soft-fp/floatunsidf.c
==============================================================================
--- trunk/libc/soft-fp/floatunsidf.c (original)
+++ trunk/libc/soft-fp/floatunsidf.c Fri May  4 04:15:57 2007
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Convert a 32bit unsigned integer to IEEE double
-   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@xxxxxxxxxx) and
 		  Jakub Jelinek (jj@xxxxxxxxxxxxxx).
@@ -32,8 +32,7 @@
 #include "soft-fp.h"
 #include "double.h"
 
-double
-__floatunsidf(USItype i)
+DFtype __floatunsidf(USItype i)
 {
   FP_DECL_EX;
   FP_DECL_D(A);

Modified: trunk/libc/soft-fp/floatunsisf.c
==============================================================================
--- trunk/libc/soft-fp/floatunsisf.c (original)
+++ trunk/libc/soft-fp/floatunsisf.c Fri May  4 04:15:57 2007
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Convert a 32bit unsigned integer to IEEE single
-   Copyright (C) 1997,1999, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@xxxxxxxxxx) and
 		  Jakub Jelinek (jj@xxxxxxxxxxxxxx).
@@ -32,8 +32,7 @@
 #include "soft-fp.h"
 #include "single.h"
 
-float
-__floatunsisf(USItype i)
+SFtype __floatunsisf(USItype i)
 {
   FP_DECL_EX;
   FP_DECL_S(A);

Modified: trunk/libc/soft-fp/op-2.h
==============================================================================
--- trunk/libc/soft-fp/op-2.h (original)
+++ trunk/libc/soft-fp/op-2.h Fri May  4 04:15:57 2007
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Basic two-word fraction declaration and manipulation.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@xxxxxxxxxx),
 		  Jakub Jelinek (jj@xxxxxxxxxxxxxx),
@@ -613,3 +613,5 @@
 #define _FP_FRAC_COPY_1_2(D, S)		(D##_f = S##_f0)
 
 #define _FP_FRAC_COPY_2_1(D, S)		((D##_f0 = S##_f), (D##_f1 = 0))
+
+#define _FP_FRAC_COPY_2_2(D,S)		_FP_FRAC_COPY_2(D,S)

Modified: trunk/libc/soft-fp/op-4.h
==============================================================================
--- trunk/libc/soft-fp/op-4.h (original)
+++ trunk/libc/soft-fp/op-4.h Fri May  4 04:15:57 2007
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Basic four-word fraction declaration and manipulation.
-   Copyright (C) 1997,1998,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997,1998,1999,2006,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@xxxxxxxxxx),
 		  Jakub Jelinek (jj@xxxxxxxxxxxxxx),
@@ -684,3 +684,5 @@
   D##_f[1] = S##_f1;				\
   D##_f[2] = D##_f[3] = 0;			\
 } while (0)
+
+#define _FP_FRAC_COPY_4_4(D,S)	_FP_FRAC_COPY_4(D,S)

Modified: trunk/libc/soft-fp/op-common.h
==============================================================================
--- trunk/libc/soft-fp/op-common.h (original)
+++ trunk/libc/soft-fp/op-common.h Fri May  4 04:15:57 2007
@@ -1153,7 +1153,8 @@
   if (_FP_FRACBITS_##dfs < _FP_FRACBITS_##sfs				 \
       || (_FP_EXPMAX_##dfs - _FP_EXPBIAS_##dfs				 \
 	  < _FP_EXPMAX_##sfs - _FP_EXPBIAS_##sfs)			 \
-      || _FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1) \
+      || (_FP_EXPBIAS_##dfs < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1 \
+	  && _FP_EXPBIAS_##dfs != _FP_EXPBIAS_##sfs))			 \
     abort();								 \
   D##_s = S##_s;							 \
   _FP_FRAC_COPY_##dwc##_##swc(D, S);					 \
@@ -1168,6 +1169,14 @@
 	{								 \
 	  if (_FP_FRAC_ZEROP_##swc(S))					 \
 	    D##_e = 0;							 \
+	  else if (_FP_EXPBIAS_##dfs					 \
+		   < _FP_EXPBIAS_##sfs + _FP_FRACBITS_##sfs - 1)	 \
+	    {								 \
+	      FP_SET_EXCEPTION(FP_EX_DENORM);				 \
+	      _FP_FRAC_SLL_##dwc(D, (_FP_FRACBITS_##dfs			 \
+				     - _FP_FRACBITS_##sfs));		 \
+	      D##_e = 0;						 \
+	    }								 \
 	  else								 \
 	    {								 \
 	      int _lz;							 \
@@ -1199,7 +1208,8 @@
 #define FP_TRUNC(dfs,sfs,dwc,swc,D,S)					     \
 do {									     \
   if (_FP_FRACBITS_##sfs < _FP_FRACBITS_##dfs				     \
-      || _FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1)     \
+      || (_FP_EXPBIAS_##sfs < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1     \
+	  && _FP_EXPBIAS_##sfs != _FP_EXPBIAS_##dfs))			     \
     abort();								     \
   D##_s = S##_s;							     \
   if (_FP_EXP_NORMAL(sfs, swc, S))					     \
@@ -1237,11 +1247,24 @@
       if (S##_e == 0)							     \
 	{								     \
 	  D##_e = 0;							     \
-	  _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);			     \
-	  if (!_FP_FRAC_ZEROP_##swc(S))					     \
+	  if (_FP_FRAC_ZEROP_##swc(S))					     \
+	    _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);			     \
+	  else								     \
 	    {								     \
 	      FP_SET_EXCEPTION(FP_EX_DENORM);				     \
-	      FP_SET_EXCEPTION(FP_EX_INEXACT);				     \
+	      if (_FP_EXPBIAS_##sfs					     \
+		  < _FP_EXPBIAS_##dfs + _FP_FRACBITS_##dfs - 1)		     \
+		{							     \
+		  _FP_FRAC_SRS_##swc(S, (_FP_WFRACBITS_##sfs		     \
+					 - _FP_WFRACBITS_##dfs),	     \
+				     _FP_WFRACBITS_##sfs);		     \
+		  _FP_FRAC_COPY_##dwc##_##swc(D, S);			     \
+		}							     \
+	      else							     \
+		{							     \
+		  _FP_FRAC_SET_##dwc(D, _FP_ZEROFRAC_##dwc);		     \
+		  _FP_FRAC_LOW_##dwc(D) |= 1;				     \
+		}							     \
 	    }								     \
 	}								     \
       else								     \

Modified: trunk/libc/stdio-common/printf_fp.c
==============================================================================
--- trunk/libc/stdio-common/printf_fp.c (original)
+++ trunk/libc/stdio-common/printf_fp.c Fri May  4 04:15:57 2007
@@ -793,7 +793,7 @@
   else
     {
       /* This is a special case.  We don't need a factor because the
-	 numbers are in the range of 0.0 <= fp < 8.0.  We simply
+	 numbers are in the range of 1.0 <= |fp| < 8.0.  We simply
 	 shift it to the right place and divide it by 1.0 to get the
 	 leading digit.	 (Of course this division is not really made.)	*/
       assert (0 <= exponent && exponent < 3 &&
@@ -1013,6 +1013,12 @@
 		  {
 		    *wstartp = '1';
 		    exponent += expsign == 0 ? 1 : -1;
+
+		    /* The above exponent adjustment could lead to 1.0e-00,
+		       e.g. for 0.999999999.  Make sure exponent 0 always
+		       uses + sign.  */
+		    if (exponent == 0)
+		      expsign = 0;
 		  }
 		else if (intdig_no == dig_max)
 		  {

Modified: trunk/libc/stdio-common/test-vfprintf.c
==============================================================================
--- trunk/libc/stdio-common/test-vfprintf.c (original)
+++ trunk/libc/stdio-common/test-vfprintf.c Fri May  4 04:15:57 2007
@@ -1,5 +1,5 @@
 /* Tests of *printf for very large strings.
-   Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2000.
 
@@ -94,6 +94,7 @@
       fprintf (fp, "%.*s", 30000, large);
       large[20000] = '\0';
       fprintf (fp, large);
+      fprintf (fp, "%-1.300000000s", "hello");
 
       if (fflush (fp) != 0 || ferror (fp) != 0 || fclose (fp) != 0)
 	{
@@ -108,11 +109,12 @@
 		  setlocale (LC_ALL, NULL));
 	  exit (1);
 	}
-      else if (st.st_size != 99999)
+      else if (st.st_size != 50000 + 30000 + 19999 + 5)
 	{
 	  printf ("file size incorrect for locale %s: %jd instead of %jd\n",
 		  setlocale (LC_ALL, NULL),
-		  (intmax_t) st.st_size, (intmax_t) 99999);
+		  (intmax_t) st.st_size,
+		  (intmax_t) 50000 + 30000 + 19999 + 5);
 	  res = 1;
 	}
       else

Modified: trunk/libc/stdio-common/tfformat.c
==============================================================================
--- trunk/libc/stdio-common/tfformat.c (original)
+++ trunk/libc/stdio-common/tfformat.c Fri May  4 04:15:57 2007
@@ -4021,6 +4021,8 @@
   {__LINE__, 0.000098,			"0.0001", "%#.0g"},
   {__LINE__, 0.0000996,			"0.00010", "%#.2g"},
   {__LINE__, 9.999999999999999e-05,	"0.0001", "%g"},
+  {__LINE__, 1.0,			"1.000000e+00", "%e"},
+  {__LINE__, .9999999999999999,		"1.000000e+00", "%e"},
 
   {0 }
 

Modified: trunk/libc/stdio-common/vfprintf.c
==============================================================================
--- trunk/libc/stdio-common/vfprintf.c (original)
+++ trunk/libc/stdio-common/vfprintf.c Fri May  4 04:15:57 2007
@@ -1160,19 +1160,26 @@
 		else							      \
 		  {							      \
 		    /* In case we have a multibyte character set the	      \
-		       situation is more compilcated.  We must not copy	      \
+		       situation is more complicated.  We must not copy	      \
 		       bytes at the end which form an incomplete character. */\
-		    wchar_t ignore[prec];				      \
+		    size_t ignore_size = (unsigned) prec > 1024 ? 1024 : prec;\
+		    wchar_t ignore[ignore_size];			      \
 		    const char *str2 = string;				      \
+		    const char *strend = string + prec;			      \
+		    if (strend < string)				      \
+		      strend = (const char *) UINTPTR_MAX;		      \
+									      \
 		    mbstate_t ps;					      \
-									      \
 		    memset (&ps, '\0', sizeof (ps));			      \
-		    if (__mbsnrtowcs (ignore, &str2, prec, prec, &ps)	      \
-			== (size_t) -1)					      \
-		      {							      \
-			done = -1;					      \
-			goto all_done;					      \
-		      }							      \
+									      \
+		    while (str2 != NULL && str2 < strend)		      \
+		      if (__mbsnrtowcs (ignore, &str2, strend - str2, 1024,   \
+					&ps) == (size_t) -1)		      \
+			{						      \
+			  done = -1;					      \
+			  goto all_done;				      \
+			}						      \
+									      \
 		    if (str2 == NULL)					      \
 		      len = strlen (string);				      \
 		    else						      \

Modified: trunk/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- trunk/libc/sysdeps/posix/getaddrinfo.c (original)
+++ trunk/libc/sysdeps/posix/getaddrinfo.c Fri May  4 04:15:57 2007
@@ -60,6 +60,10 @@
 #include <not-cancel.h>
 #include <nscd/nscd-client.h>
 #include <nscd/nscd_proto.h>
+
+#ifdef HAVE_NETLINK_ROUTE
+# include <kernel-features.h>
+#endif
 
 #ifdef HAVE_LIBIDN
 extern int __idna_to_ascii_lz (const char *input, char **output, int flags);
@@ -1095,6 +1099,10 @@
 			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       7, 6 },
     { { .in6_u
+	= { .u6_addr8 = { 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
+      32, 7 },
+    { { .in6_u
 	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
       0, 1 }
@@ -1728,6 +1736,16 @@
 }
 
 
+#if HAVE_NETLINK_ROUTE
+# if __ASSUME_NETLINK_SUPPORT == 0
+/* Defined in ifaddrs.c.  */
+extern int __no_netlink_support attribute_hidden;
+# else
+#  define __no_netlink_support 0
+# endif
+#endif
+
+
 int
 getaddrinfo (const char *name, const char *service,
 	     const struct addrinfo *hints, struct addrinfo **pai)
@@ -1763,20 +1781,74 @@
     return EAI_BADFLAGS;
 
   struct in6addrinfo *in6ai = NULL;
-  size_t in6ailen;
+  size_t in6ailen = 0;
   bool seen_ipv4 = false;
   bool seen_ipv6 = false;
+#ifdef HAVE_NETLINK_ROUTE
+  int sockfd = -1;
+  pid_t nl_pid;
+#endif
   /* We might need information about what kind of interfaces are available.
      But even if AI_ADDRCONFIG is not used, if the user requested IPv6
      addresses we have to know whether an address is deprecated or
      temporary.  */
   if ((hints->ai_flags & AI_ADDRCONFIG) || hints->ai_family == PF_UNSPEC
       || hints->ai_family == PF_INET6)
-    /* Determine whether we have IPv4 or IPv6 interfaces or both.  We
-       cannot cache the results since new interfaces could be added at
-       any time.  */
-    __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
-
+    {
+      /* Determine whether we have IPv4 or IPv6 interfaces or both.  We
+	 cannot cache the results since new interfaces could be added at
+	 any time.  */
+      __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+#ifdef HAVE_NETLINK_ROUTE
+      if (! __no_netlink_support)
+	{
+	  sockfd = __socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
+
+	  struct sockaddr_nl nladdr;
+	  memset (&nladdr, '\0', sizeof (nladdr));
+	  nladdr.nl_family = AF_NETLINK;
+
+	  socklen_t addr_len = sizeof (nladdr);
+
+	  if (sockfd >= 0
+	      && __bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0
+	      && __getsockname (sockfd, (struct sockaddr *) &nladdr,
+				&addr_len) == 0
+	      && make_request (sockfd, nladdr.nl_pid, &seen_ipv4, &seen_ipv6,
+			       in6ai, in6ailen) == 0)
+	    {
+	      /* It worked.  */
+	      nl_pid = nladdr.nl_pid;
+	      goto got_netlink_socket;
+	    }
+
+	  if (sockfd >= 0)
+	    close_not_cancel_no_status (sockfd);
+
+#if __ASSUME_NETLINK_SUPPORT == 0
+	  /* Remember that there is no netlink support.  */
+	  if (errno != EMFILE && errno != ENFILE)
+	    __no_netlink_support = 1;
+#else
+	  else
+	    {
+	      if (errno != EMFILE && errno != ENFILE)
+		sockfd = -2;
+
+	      /* We cannot determine what interfaces are available.  Be
+		 pessimistic.  */
+	      seen_ipv4 = true;
+	      seen_ipv6 = true;
+	      return;
+	    }
+#endif
+	}
+#endif
+    }
+
+#ifdef HAVE_NETLINK_ROUTE
+ got_netlink_socket:
+#endif
   if (hints->ai_flags & AI_ADDRCONFIG)
     {
       /* Now make a decision on what we return, if anything.  */

Modified: trunk/ports/ChangeLog.hppa
==============================================================================
--- trunk/ports/ChangeLog.hppa (original)
+++ trunk/ports/ChangeLog.hppa Fri May  4 04:15:57 2007
@@ -1,3 +1,9 @@
+2007-05-01  Carlos O'Donell  <carlos@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/hppa/linuxthreads/bits/pthreadtypes.h
+	[__USE_XOPEN2K]: Define pthread_rwlock_t and 
+	pthread_rwlockattr_t. 
+
 2007-02-02  Carlos O'Donell  <carlos@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/hppa/sysdep.h (PTR_MANGLE): Define.

Modified: trunk/ports/sysdeps/unix/sysv/linux/hppa/linuxthreads/bits/pthreadtypes.h
==============================================================================
--- trunk/ports/sysdeps/unix/sysv/linux/hppa/linuxthreads/bits/pthreadtypes.h (original)
+++ trunk/ports/sysdeps/unix/sysv/linux/hppa/linuxthreads/bits/pthreadtypes.h Fri May  4 04:15:57 2007
@@ -111,8 +111,7 @@
 /* Once-only execution */
 typedef int pthread_once_t;
 
-
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
 /* Read-write locks.  */
 typedef struct _pthread_rwlock_t
 {