public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "andres at anarazel dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/100442] Spurious -Wstringop-overread error with odd boundaries
Date: Tue, 15 Feb 2022 22:54:55 +0000	[thread overview]
Message-ID: <bug-100442-4-bgkrCyTREL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100442-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100442

--- Comment #4 from Andres Freund <andres at anarazel dot de> ---
> Ending up with an excessive range isn't uncommon in code that freely converts between signed and unsigned integers (e.g., by passing an int to a size_t argument) and involves conditionals like those in tsCompareString().  GCC must assume the signed integers may be negative and convert to very large positive values.  Changing tsCompareString() to take size_t arguments instead of int avoids the warning:

That true - and I agree that that code isn't great.

But the warning message is quite confusing: A bound of "[18446744073709551612,
18446744073709551615]" doesn't sound right from the perspective a compiler
user, rather than compiler author. Clearly the lower bound isn't actually
18446744073709551612.

      parent reply	other threads:[~2022-02-15 22:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06  6:09 [Bug c/100442] New: " andres at anarazel dot de
2021-05-06  8:54 ` [Bug tree-optimization/100442] " pinskia at gcc dot gnu.org
2021-05-06  9:45 ` andres at anarazel dot de
2021-05-06 15:39 ` msebor at gcc dot gnu.org
2022-02-15 22:54 ` andres at anarazel dot de [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100442-4-bgkrCyTREL@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).