Bug 66

Summary: wcstold functions are incorrect for 128bit long double
Product: glibc Reporter: H.J. Lu <hjl.tools>
Component: libcAssignee: GOTO Masanori <gotom>
Status: RESOLVED FIXED    
Severity: normal Flags: fweimer: security-
Priority: P2    
Version: 2.3.3   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: A patch to fix 128bit wcstold/wcstold_l

Description H.J. Lu 2004-03-09 22:11:37 UTC
[hjl@gnu libc]$ find -name wcstold.c
./wcsmbs/wcstold.c
[hjl@gnu libc]$ find -name strtold.c
./sysdeps/generic/strtold.c
./sysdeps/ieee754/ldbl-128/strtold.c
./sysdeps/ieee754/ldbl-96/strtold.c
./sysdeps/m68k/strtold.c

We are using 96 bit double for 128bit long double in wcstold functions.
wcstold should be treated similar as strtold.
Comment 1 H.J. Lu 2004-03-11 16:27:18 UTC
Created attachment 30 [details]
A patch to fix 128bit wcstold/wcstold_l

There is only one wcstold.c under wcsmbs, which is used on all
platforms. It has

# define SET_MANTISSA(flt, mant) \
  do { union ieee854_long_double u;					      \

       u.d = (flt);							      \

       if ((mant & 0x7fffffffffffffffULL) == 0) 			      \

	 mant = 0x4000000000000000ULL;					      \

       u.ieee.mantissa0 = (((mant) >> 32) & 0x7fffffff) | 0x80000000;	      \

       u.ieee.mantissa1 = (mant) & 0xffffffff;				      \

       (flt) = u.d;							      \

  } while (0)

But it is for 96bit IEEE long double and won't work for 128bit IEEE
long double. This patch just includes <strtold.c> or <strtold_l.c>,
which support different long doubles.
Comment 2 Ulrich Drepper 2004-03-15 03:50:21 UTC
Should be handled correctly in CVS.  Not with the attached patch, though, but
with a completely different solution.