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]

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


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]

This error occurs 9 times.
Compiling with -O2 is fine.

The first error occurs for strlen/wcslen tests in line 98 for the inner-for-loop. See also the attached smaller testcase.

There's a new pass in GCC 7 and the warning also occurs
with -O2 -fsplit-loops and it disappears with -O3 -fno-split-loops.

The warning also occurs with an extra test which ensures that size is > 0. The warning disappears if the outer loop uses "outer >= 0" instead of the MAX macro and the extra test is done.

Any ideas how to fix this?
Is this a GCC 7 regression and we should file a bug against GCC 7?

Bye
Stefan

Attachment: tst-warn.c
Description: Text document


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