public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/94247] Wrong char-subscripts warning for limited-range index
Date: Mon, 23 Mar 2020 23:52:25 +0000	[thread overview]
Message-ID: <bug-94247-4-EMC7pk53Ki@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94247-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #6)
> No, it diagnoses the main bug

Nope, it does not.  -Wchar-subscripts is designed and documented to diagnose a
common cause of a bug.  The actual bug itself (which, as noted in pr94182, the
manual neglects to describe) is in inadvertently using a negative index as a
result of sign extension when a positive index is intended.  When that cannot
happen there is obviously no bug to diagnose.

There's no doubt that there is room for improvement in both warnings.  Some of
the false negatives might be avoidable by enhancing -Wchar-subscripts in the
front-end (e.g., fixing the remainder of pr29455), but the better ROI is in
continuing to improve -Warray-bounds (pr56456).

  parent reply	other threads:[~2020-03-23 23:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-21 10:42 [Bug c/94247] New: " roland.illig at gmx dot de
2020-03-21 10:48 ` [Bug c/94247] " pinskia at gcc dot gnu.org
2020-03-21 11:09 ` roland.illig at gmx dot de
2020-03-23  7:37 ` rguenth at gcc dot gnu.org
2020-03-23  7:37 ` rguenth at gcc dot gnu.org
2020-03-23 17:32 ` msebor at gcc dot gnu.org
2020-03-23 18:41 ` jakub at gcc dot gnu.org
2020-03-23 23:52 ` msebor at gcc dot gnu.org [this message]
2020-03-24  0:03 ` pinskia at gcc dot gnu.org

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-94247-4-EMC7pk53Ki@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).