[Top][All Lists]

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

Re: printf-safe checks of invalid long double values

From: Pádraig Brady
Subject: Re: printf-safe checks of invalid long double values
Date: Fri, 28 Nov 2014 13:56:49 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 28/11/14 13:32, Ondřej Bílka wrote:
> On Thu, Nov 27, 2014 at 08:37:59PM -0800, Paul Eggert wrote:
>> Pádraig Brady wrote:
>>>   Are these checks backed up by corresponding replacement code?
>>>   Are these checks correct?
>>>   Why has glibc not been updated in the 7 years since the checks were added?
>> As I recall, this comes from an old dispute about what glibc should
>> do when asked to print floating-point bit-patterns that cannot be
>> generated by the machine's floating-point operations.  This has
>> undefined behavior in glibc (and POSIX allows this), but undefined
>> behavior can be catastrophic in programs like 'od' which will crash
>> when asked to print arbitrary data as if it were floating-point.  So
>> coreutils insists on a substitute for printf for this situation.
>> See the thread starting here:
>> http://lists.gnu.org/archive/html/bug-gnulib/2007-06/msg00046.html
>>From bug ticket pseudo zero patterns were fixed by 
>       2007-06-06  Jakub Jelinek  <address@hidden>
>       [BZ #4586]
>       * sysdeps/i386/ldbl2mpn.c (__mpn_extract_long_double): Treat
>       pseudo-zeros as zero.
>       * sysdeps/x86_64/ldbl2mpn.c: New file.
>       * sysdeps/ia64/ldbl2mpn.c: New file.
> You could write patch to handle pseudo-infinity as well.

Yes, glibc could definitely improve here. I've logged:


reply via email to

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