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 tree-optimization/100137] [10/11 Regression] -Warray-bounds false positive on varying offset plus negative
Date: Mon, 19 Apr 2021 15:39:26 +0000	[thread overview]
Message-ID: <bug-100137-4-IOLPRLwy4g@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100137-4@http.gcc.gnu.org/bugzilla/>

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
      Known to work|                            |10.2.0
          Component|c++                         |tree-optimization
             Status|UNCONFIRMED                 |NEW
            Summary|-Werror=array-bounds false  |[10/11 Regression]
                   |positive:"subscript -1 is   |-Warray-bounds false
                   |outside array bounds"       |positive on varying offset
                   |                            |plus negative
   Last reconfirmed|                            |2021-04-19
      Known to fail|                            |10.3.0, 11.0

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  The bug is caused by -Warray-bounds ignoring varying offsets
instead of setting the offset range to that of the referenced object. 
Bisection points to g:e7fd3b783238d034018443e43a58ff87908b4db6 but that just
exposed the underlying bug in the warning.  The test case triggers the false
positive in 10.3.0 and 11.0 but not in 10.2.0 or prior. 

int main ()
{
  ...
  <bb 5> [local count: 114863531]:
  # len_11 = PHI <18446744073709551615(3), len_23(4)>
  s ={v} {CLOBBER};
  s.first_ = &hello;
  iftmp.0_13 = &hello + len_11;                          <<< len_11:
VR_VARYING, iftmp.0_13 taken to point to &hello
  s.last_ = iftmp.0_13;
  _15 = len_11 != 0;
  MEM[(char &)iftmp.0_13 + 18446744073709551615] = 50;   <<< iftmp.0_13[-1] =
'2'; <<< -Warray-bounds
  hello ={v} {CLOBBER};
  s ={v} {CLOBBER};
  return 0;

}

  parent reply	other threads:[~2021-04-19 15:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 20:40 [Bug c++/100137] New: -Werror=array-bounds false positive:"subscript -1 is outside array bounds" spamandnoise at gmail dot com
2021-04-18 20:42 ` [Bug c++/100137] " spamandnoise at gmail dot com
2021-04-19 15:39 ` msebor at gcc dot gnu.org [this message]
2021-04-19 15:47 ` [Bug tree-optimization/100137] [10/11 Regression] -Warray-bounds false positive on varying offset plus negative msebor at gcc dot gnu.org
2021-04-19 16:56 ` spamandnoise at gmail dot com
2021-06-21 23:35 ` [Bug tree-optimization/100137] [10/11/12 " msebor at gcc dot gnu.org
2021-07-06  6:45 ` rguenth at gcc dot gnu.org
2021-07-06  6:45 ` rguenth at gcc dot gnu.org
2021-07-07 20:14 ` cvs-commit at gcc dot gnu.org
2021-07-07 20:27 ` [Bug tree-optimization/100137] [10/11 " msebor at gcc dot gnu.org
2021-07-13 16:10 ` msebor at gcc dot gnu.org
2022-06-28 10:44 ` jakub at gcc dot gnu.org
2023-07-07 10:39 ` [Bug tree-optimization/100137] [11 " rguenth 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-100137-4-IOLPRLwy4g@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).