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] Fix gcc 9 build errors for make xcheck.


On Jun 17 2019, Stefan Liebler <stli@linux.ibm.com> wrote:

> On 6/17/19 4:07 PM, Andreas Schwab wrote:
>> On Jun 17 2019, Stefan Liebler <stli@linux.ibm.com> wrote:
>>
>>> diff --git a/benchtests/bench-strstr.c b/benchtests/bench-strstr.c
>>> index 2cbe13e9ac..14053e7a22 100644
>>> --- a/benchtests/bench-strstr.c
>>> +++ b/benchtests/bench-strstr.c
>>> @@ -147,7 +147,7 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result)
>>>     if (res != exp_result)
>>>       {
>>>         error (0, 0, "Wrong result in function %s %s %s", impl->name,
>>> -	     res, exp_result);
>>> +	     res, (exp_result == NULL) ? "NULL" : exp_result);
>>
>> res can be NULL too.
>>
>>> diff --git a/string/test-strcasestr.c b/string/test-strcasestr.c
>>> index 0a16f85dcd..1773581a3e 100644
>>> --- a/string/test-strcasestr.c
>>> +++ b/string/test-strcasestr.c
>>> @@ -67,7 +67,7 @@ check_result (impl_t *impl, const char *s1, const char *s2,
>>>     if (result != exp_result)
>>>       {
>>>         error (0, 0, "Wrong result in function %s %s %s", impl->name,
>>> -	     result, exp_result);
>>> +	     result, (exp_result == NULL) ? "NULL" : exp_result);
>>
>> result can be NULL too.
>>
>> Andreas.
>>
>
> That's true.
> The compiler does not emit a warning for those.
> Shall we nevertheless add a check?

Either check both or none.  If NULL is a problem then it needs to be
checked everywhere.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


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