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/102006] A false warning "Array subscript -N is outside array bounds warning"
Date: Fri, 27 Aug 2021 17:00:50 +0000	[thread overview]
Message-ID: <bug-102006-4-p2zf2QY0Y0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102006-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> ---
With the reduced test case from attachment 51366 I get the same warning:

$ gcc -O2 -S -Wall -std=c++20 -xc++ ListTest.cpp.i
In constructor ‘double_iterator<T, DLink, ForwardLink,
BackwardLink>::double_iterator(single_iterator<T, ForwardLink>) [with T =
Element; DLink = quick_link; ForwardLink = forward_link<quick_link>;
BackwardLink = backward_link<quick_link>]’,
    inlined from ‘quick_list<T, DLink>::iterator quick_list<T, DLink>::end()
[with T = Element; DLink = quick_link]’ at ListTest.cpp.i:66:43,
    inlined from ‘void ListHolder::PrintList()’ at ListTest.cpp.i:92:73,
    inlined from ‘void List_TestFunc(const TestContext&)’ at
ListTest.cpp.i:103:19:
ListTest.cpp.i:30:96: warning: array subscript 0 is outside array bounds of
‘ListHolder [1]’ [-Warray-bounds]
   30 | ator<T, ForwardLink> i) : double_iterator(static_cast<DLink *>(*i)) { }
      |                                                                   ^

ListTest.cpp.i: In function ‘void List_TestFunc(const TestContext&)’:
ListTest.cpp.i:102:14: note: at offset -16 into object ‘holder’ of size 16
  102 |   ListHolder holder (context);
      |              ^~~~~~

  parent reply	other threads:[~2021-08-27 17:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21 11:35 [Bug c++/102006] New: " d-ef at yandex dot ru
2021-08-21 12:46 ` [Bug c++/102006] " pinskia at gcc dot gnu.org
2021-08-21 13:19 ` d-ef at yandex dot ru
2021-08-21 13:20 ` d-ef at yandex dot ru
2021-08-21 13:23 ` d-ef at yandex dot ru
2021-08-21 18:21 ` [Bug tree-optimization/102006] " msebor at gcc dot gnu.org
2021-08-23  8:54 ` rguenth at gcc dot gnu.org
2021-08-23  9:50 ` d-ef at yandex dot ru
2021-08-23  9:53 ` d-ef at yandex dot ru
2021-08-27 16:59 ` msebor at gcc dot gnu.org
2021-08-27 17:00 ` msebor at gcc dot gnu.org [this message]
2022-02-16  1:33 ` d-ef at yandex dot ru
2022-02-16 17:25 ` msebor 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-102006-4-p2zf2QY0Y0@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).