This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]