[Bug string/21982] stratcliff.c: error: assuming signed overflow does not occur with -O3

cvs-commit at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Mon Sep 11 16:02:00 GMT 2017


https://sourceware.org/bugzilla/show_bug.cgi?id=21982

--- Comment #14 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.26/master has been updated
       via  56ce01906ecb0a3e04411f8ceb60b27f4877f070 (commit)
      from  5f5532caf820f47f714d09766082f1e070c12cfb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=56ce01906ecb0a3e04411f8ceb60b27f4877f070

commit 56ce01906ecb0a3e04411f8ceb60b27f4877f070
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 23 08:22:52 2017 -0700

    string/stratcliff.c: Replace int with size_t [BZ #21982]

    Fix GCC 7 errors when string/stratcliff.c is compiled with -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]

        [BZ #21982]
        * string/stratcliff.c (do_test): Declare size, nchars, inner,
        middle and outer with size_t instead of int.  Repleace %d and
        %Zd with %zu in printf.  Update "MAX (0, nchars - 128)" and
        "MAX (outer, nchars - 64)" to support unsigned outer and
        nchars.  Also exit loop when outer == 0.

    (cherry picked from commit 376b40a27a6783ea7f73ae577be320df66aeb36d)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog           |    9 ++
 string/stratcliff.c |  276 +++++++++++++++++++++++++++++++--------------------
 2 files changed, 176 insertions(+), 109 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list