This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Do not use const attribute for nan functions (bug 23277) [committed]
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).
--
Joseph S. Myers
joseph@codesourcery.com