Warnings in string/stratcliff.c, wcsmbs/wcsatcliff.c with GCC 7 -O3

Stefan Liebler stli@linux.vnet.ibm.com
Thu Mar 23 11:16:00 GMT 2017


On 03/22/2017 03:53 PM, Wainer dos Santos Moschetta wrote:
>
> On 03/22/2017 11:29 AM, Stefan Liebler wrote:
>> Hi,
>>
>> Compiling string/stratcliff.c with GCC 7 and -O3 leads to the following warning/errors on s390x / x86_64:
>> ../test-skeleton.c: In function ‘legacy_test_function’:
>> cc1: error: assuming signed overflow does not occur when assuming that (X - c) <= X is always true [-Werror=strict-overflow]
>
> https://sourceware.org/ml/libc-alpha/2017-03/msg00422.html
> Could you give a try with above patch in?
>
> It updates the string tests to the support test driver. Above error occurs in the legacy test skeleton. Otherwise the support test-driver will need a fix too.
>

The error does not occur in the legacy test skeleton.  Instead one of 
the errors occur in do_test in string/stratcliff.c around line 96:
       /* strlen/wcslen test */
       for (outer = nchars - 1; outer >= MAX (0, nchars - 128); --outer)
	{
	  for (inner = MAX (outer, nchars - 64); inner < nchars; ++inner)
	    {

I've applied your patch and build the test with GCC 7 -O3:
stratcliff.c: In function ‘do_test’:
cc1: error: assuming signed overflow does not occur when assuming that 
(X - c) <= X is always true [-Werror=strict-overflow]
...

Bye
Stefan



More information about the Libc-alpha mailing list