[PATCH v4] Only build libm with -fno-math-errno (bug 24024)

Florian Weimer fweimer@redhat.com
Thu Jan 3 07:17:00 GMT 2019


* Joseph Myers:

> On Thu, 3 Jan 2019, Aurelien Jarno wrote:
>
>> +static int
>> +do_test (void)
>> +{
>> +  char *msg;
>> +
>> +  errno = 0;
>> +  msg = strerror (-3);
>> +  (void) msg;
>> +
>> +  return errno;
>
> My understanding is that the idea is that this will fail if errno is 
> wrongly nonzero after strerror.  But it's implicitly relying on the 
> wrongly set errno not having 77 as its low-order 8 bits (because that 
> would result in the test being UNSUPPORTED), and not being a nonzero value 
> with low 8 bits zero (because WEXITSTATUS only returns the low 8 bits).
>
> OK with errno != 0 returned instead, to avoid those issues.

You can also use

    TEST_COMPARE (errno, 0);

This will log the incorrect value on failure.

Thanks,
Florian



More information about the Libc-alpha mailing list