public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102006] New: A false warning "Array subscript -N is outside array bounds warning"
@ 2021-08-21 11:35 d-ef at yandex dot ru
  2021-08-21 12:46 ` [Bug c++/102006] " pinskia at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: d-ef at yandex dot ru @ 2021-08-21 11:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102006
           Summary: A false warning "Array subscript -N is outside array
                    bounds warning"
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: d-ef at yandex dot ru
  Target Milestone: ---

I am not sure if referencing an entire Git repository is allowed here, but
probably it is an easier way to reproduce the bug:

git clone https://github.com/dmitriano/Awl --branch gcc-warn
mkdir -p build/awl
cd build/awl
cmake ../../Awl/ -DCMAKE_BUILD_TYPE=Release
make Tests/ListTest.cpp.o

Compiler output:

/home/def/Awl/Tests/ListTest.cpp: In function ‘void List_TestFunc(const
awl::testing::TestContext&)’:
/home/def/Awl/Tests/ListTest.cpp:118:70: warning: array subscript 0 is outside
array bounds of ‘{anonymous}::ListHolder<awl::quick_link> [1]’ [-Warray-bounds]
  118 |             for (typename ELEMENT_LIST::iterator i = list.begin(); i !=
list.end(); ++i)
      |                                                                   
~~^~~~~~~~~~~~~
/home/def/Awl/Tests/ListTest.cpp:138:33: note: while referencing ‘holder’
  138 |     ListHolder<awl::quick_link> holder(context);
      |                                 ^~~~~~

If you comment line 114 in Tests/ListTest.cpp the warning disappears that
probably is a bit strange, because this line does not relate to the code that
produces the warning.

My OS: Ubuntu 18.04
My compiler: g++ (Ubuntu 11.1.0-1ubuntu1~18.04.1) 11.1.0

for more information on how to build Awl on Ubuntu 18 see
https://developernote.com/2021/08/compiling-awl-on-ubuntu-18-with-gcc-11/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-02-16 17:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21 11:35 [Bug c++/102006] New: A false warning "Array subscript -N is outside array bounds warning" 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
2022-02-16  1:33 ` d-ef at yandex dot ru
2022-02-16 17:25 ` msebor at gcc dot gnu.org

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).