public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41847]  New: warning: array subscript is above array bounds
@ 2009-10-27 14:46 caolanm at redhat dot com
  2009-10-27 14:47 ` [Bug c++/41847] " caolanm at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: caolanm at redhat dot com @ 2009-10-27 14:46 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]

#  gcc -Wall -O2 -c demo.cxx
demo.cxx: In function ‘void isInvertible()’:
demo.cxx:12: warning: array subscript is above array bounds

gcc --version
gcc (GCC) 4.4.2 20091019 (Red Hat 4.4.2-5)

I've the same results with...
gcc (GCC) 4.4.2 20091019 (Red Hat 4.4.2-5) (gcc-4.4.2-5.el6.s390x)
gcc (GCC) 4.4.1 20090725 (Red Hat 4.4.1-3) (gcc-4.4.1-3.s390x)
gcc (GCC) 4.4.0 20090506 (Red Hat 4.4.0-4) (gcc-4.4.0-4.s390x)

Possibly a duplicate of #35392
so its not a very recent thing.

I only get this warning (and related runtime failure) with s390x. Equivalent
x86_64/x86/ppc/ppc64/arm gcc's appear fine


-- 
           Summary: warning: array subscript is above array bounds
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: caolanm at redhat dot com
 GCC build triplet: s390x-ibm-linux
  GCC host triplet: s390x-ibm-linux
GCC target triplet: s390x-ibm-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41847


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

* [Bug c++/41847] warning: array subscript is above array bounds
  2009-10-27 14:46 [Bug c++/41847] New: warning: array subscript is above array bounds caolanm at redhat dot com
@ 2009-10-27 14:47 ` caolanm at redhat dot com
  2009-10-27 16:34 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: caolanm at redhat dot com @ 2009-10-27 14:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from caolanm at redhat dot com  2009-10-27 14:47 -------
Created an attachment (id=18916)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18916&action=view)
standalone demo

gcc -Wall -O2 -c demo.cxx


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41847


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

* [Bug c++/41847] warning: array subscript is above array bounds
  2009-10-27 14:46 [Bug c++/41847] New: warning: array subscript is above array bounds caolanm at redhat dot com
  2009-10-27 14:47 ` [Bug c++/41847] " caolanm at redhat dot com
@ 2009-10-27 16:34 ` jakub at gcc dot gnu dot org
  2009-10-27 16:53 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-27 16:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2009-10-27 16:33 -------
Reproduceable on today's trunk as well (s390x-linux target).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41847


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

* [Bug c++/41847] warning: array subscript is above array bounds
  2009-10-27 14:46 [Bug c++/41847] New: warning: array subscript is above array bounds caolanm at redhat dot com
  2009-10-27 14:47 ` [Bug c++/41847] " caolanm at redhat dot com
  2009-10-27 16:34 ` jakub at gcc dot gnu dot org
@ 2009-10-27 16:53 ` jakub at gcc dot gnu dot org
  2009-10-27 20:17 ` caolanm at redhat dot com
  2009-10-31 17:59 ` caolanm at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-27 16:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2009-10-27 16:53 -------
The issue is that for some strange reason VRP sees the loop iterator (which is
[0, 4) ) as VARYING.  Then the fDum = get(b, b) is called when
b is not 3, and get uses the return maLine[nRow].get(nColumn); for nRow < 3.
So, VRP figures that in return mpLine->get(nColumn); nColumn (== b) is
necessarily [4, 65535] and reports out of bounds access on something that will
really never be executed.
If VRP figured that b is [0, 4), it would have been able to tell that the bb's
are unreachable and not report diagnostics in that case.

I wonder what related runtime failure you are talking about though, this to me
looks like a false positive on something that is never executed (although not
optimized out at least until *.optimized dump).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41847


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

* [Bug c++/41847] warning: array subscript is above array bounds
  2009-10-27 14:46 [Bug c++/41847] New: warning: array subscript is above array bounds caolanm at redhat dot com
                   ` (2 preceding siblings ...)
  2009-10-27 16:53 ` jakub at gcc dot gnu dot org
@ 2009-10-27 20:17 ` caolanm at redhat dot com
  2009-10-31 17:59 ` caolanm at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: caolanm at redhat dot com @ 2009-10-27 20:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from caolanm at redhat dot com  2009-10-27 20:17 -------
At runtime of the original version of one of these loops (or a similar one, I
decided for ease to boil down to the warning case for this bug) goes way past
the RowSpan limits. If this one is cosmetic, then I've got another more
difficult to extract one to do.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41847


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

* [Bug c++/41847] warning: array subscript is above array bounds
  2009-10-27 14:46 [Bug c++/41847] New: warning: array subscript is above array bounds caolanm at redhat dot com
                   ` (3 preceding siblings ...)
  2009-10-27 20:17 ` caolanm at redhat dot com
@ 2009-10-31 17:59 ` caolanm at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: caolanm at redhat dot com @ 2009-10-31 17:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from caolanm at redhat dot com  2009-10-31 17:59 -------
bug 41892 now logged for the concrete runtime problem I'm encountering.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41847


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

end of thread, other threads:[~2009-10-31 17:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-27 14:46 [Bug c++/41847] New: warning: array subscript is above array bounds caolanm at redhat dot com
2009-10-27 14:47 ` [Bug c++/41847] " caolanm at redhat dot com
2009-10-27 16:34 ` jakub at gcc dot gnu dot org
2009-10-27 16:53 ` jakub at gcc dot gnu dot org
2009-10-27 20:17 ` caolanm at redhat dot com
2009-10-31 17:59 ` caolanm at redhat dot com

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