Do not use const attribute for nan functions (bug 23277) [committed]

Florian Weimer fw@deneb.enyo.de
Wed Jun 13 04:58:00 GMT 2018


* Joseph Myers:

> On Tue, 12 Jun 2018, Florian Weimer wrote:
>
>> * Joseph Myers:
>> 
>> > +static int
>> > +do_test (void)
>> > +{
>> > +  char buf[2] = { '2', 0 };
>> > +  float a = nanf (buf);
>> > +  buf[0] = '3';
>> > +  float b = nanf (buf);
>> > +  return memcmp (&a, &b, sizeof (float)) == 0;
>> > +}
>> 
>> By the way, there's TEST_COMPARE_BLOB now, which can simplify
>> debugging of test failures because the failure message includes the
>> blobs that differ.
>
> In this case, the requirement is actually that the blobs must differ, with 
> a failure if they are the same (if the compiler optimized out the second 
> nanf call and so produced the same NaN for both calls).

Oh, right.  I was confused.



More information about the Libc-alpha mailing list