[PATCH] Fix gcc 9 build errors for make xcheck.

Stefan Liebler stli@linux.ibm.com
Mon Jun 17 16:03:00 GMT 2019


On 6/17/19 4:59 PM, Andreas Schwab wrote:
> 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.
> 
Okay I've added the two mentioned occurrences and also added checks in 
string/test-strstr.c.

Bye
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20190617_1755_gcc9warnings.patch
Type: text/x-patch
Size: 4610 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20190617/448048ce/attachment.bin>


More information about the Libc-alpha mailing list