bug-gnulib
[Top][All Lists]
Advanced

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

Re: test-vsprintf-posix: make check failure


From: Bruno Haible
Subject: Re: test-vsprintf-posix: make check failure
Date: Tue, 23 Sep 2008 01:58:27 +0200
User-agent: KMail/1.5.4

Hi Eric,

> Like so.  Bruno, okay to apply?

Thanks for the analysis. The patch is nearly perfect. Only the change of the
'precision' variable from 6 to 0 comes a bit too late: by this time, its
value 6 has already been used for computing the size of a memory allocation.
(I.e. it would allocates more memory than necessary.) I prefer this, and
have committed this. (Btw, yes, gmane applied line breaking to your patch.)


2008-09-22  Eric Blake  <address@hidden>
            Bruno Haible  <address@hidden>

        vasnprintf: fix x86/glibc regression on printf("%La", 0.0L)
        * lib/vasnprintf.c (VASNPRINTF): Support 0.0 on platforms that
        supply %A but mishandle pseudo-NaN.
        Reported by Simon Josefsson.

*** lib/vasnprintf.c.orig       2008-09-23 01:51:55.000000000 +0200
--- lib/vasnprintf.c    2008-09-23 01:46:21.000000000 +0200
***************
*** 2663,2671 ****
  
                /* POSIX specifies the default precision to be 6 for %f, %F,
                   %e, %E, but not for %g, %G.  Implementations appear to use
!                  the same default precision also for %g, %G.  */
                if (!has_precision)
!                 precision = 6;
  
                /* Allocate a temporary buffer of sufficient size.  */
  # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
--- 2663,2673 ----
  
                /* POSIX specifies the default precision to be 6 for %f, %F,
                   %e, %E, but not for %g, %G.  Implementations appear to use
!                  the same default precision also for %g, %G.  But for %a, %A,
!                  the default precision is 0.  */
                if (!has_precision)
!                 if (!(dp->conversion == 'a' || dp->conversion == 'A'))
!                   precision = 6;
  
                /* Allocate a temporary buffer of sufficient size.  */
  # if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
***************
*** 3182,3187 ****
--- 3184,3205 ----
                                      *p++ = '0';
                                  }
                              }
+                           else if (dp->conversion == 'a' || dp->conversion == 
'A')
+                             {
+                               *p++ = '0';
+                               *p++ = dp->conversion - 'A' + 'X';
+                               pad_ptr = p;
+                               *p++ = '0';
+                               if ((flags & FLAG_ALT) || precision > 0)
+                                 {
+                                   *p++ = decimal_point_char ();
+                                   for (; precision > 0; precision--)
+                                     *p++ = '0';
+                                 }
+                               *p++ = dp->conversion - 'A' + 'P';
+                               *p++ = '+';
+                               *p++ = '0';
+                             }
                            else
                              abort ();
  #  endif





reply via email to

[Prev in Thread] Current Thread [Next in Thread]