public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45195] New: incorrect "array subscript above bounds" warning
@ 2010-08-05 12:21 rahul at icerasemi dot com
2010-08-05 13:16 ` [Bug tree-optimization/45195] " rguenth at gcc dot gnu dot org
2010-08-06 8:02 ` rahul at icerasemi dot com
0 siblings, 2 replies; 3+ messages in thread
From: rahul at icerasemi dot com @ 2010-08-05 12:21 UTC (permalink / raw)
To: gcc-bugs
Using GCC 4.4.1 and the following command, test generates an "array subscript
is above array bounds" warning.
gcc -S -Os test.c -Wall
void foo (int b[2][6])
{
int i = 0;
for (i = 0; i < 6; i++)
{
int *pb = &b[1][i];
*pb = 0;
}
}
Output from VRP looks like
foo (int[6] * b)
{
int i;
unsigned int D.1240;
unsigned int i.0;
<bb 2>:
goto <bb 6>;
<bb 3>:
# i_16 = PHI <i_1(4), i_14(6)>
i.0_6 = (unsigned int) i_16;
D.1240_7 = i.0_6 + 6;
(*b_4(D))[D.1240_7] = 0; <-- warning generated here
i_10 = i_16 + 1;
<bb 4>:
# i_1 = PHI <i_10(3)>
if (i_1 <= 5)
goto <bb 3>;
else
goto <bb 5>;
<bb 5>:
return;
<bb 6>:
# i_14 = PHI <0(2)>
goto <bb 3>;
}
In the statement (*b_4(D))[D.1240_7] = 0, range of b_4 appears to be [0 5]
while the range of index D.1240_7 is [6 11].
--
Summary: incorrect "array subscript above bounds" warning
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rahul at icerasemi dot com
GCC build triplet: i686-pc-linux
GCC host triplet: i686-pc-linux
GCC target triplet: i686-pc-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45195
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/45195] incorrect "array subscript above bounds" warning
2010-08-05 12:21 [Bug tree-optimization/45195] New: incorrect "array subscript above bounds" warning rahul at icerasemi dot com
@ 2010-08-05 13:16 ` rguenth at gcc dot gnu dot org
2010-08-06 8:02 ` rahul at icerasemi dot com
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-05 13:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2010-08-05 13:16 -------
Fixed in 4.4.3.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Known to work| |4.4.3
Resolution| |FIXED
Target Milestone|--- |4.4.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45195
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug tree-optimization/45195] incorrect "array subscript above bounds" warning
2010-08-05 12:21 [Bug tree-optimization/45195] New: incorrect "array subscript above bounds" warning rahul at icerasemi dot com
2010-08-05 13:16 ` [Bug tree-optimization/45195] " rguenth at gcc dot gnu dot org
@ 2010-08-06 8:02 ` rahul at icerasemi dot com
1 sibling, 0 replies; 3+ messages in thread
From: rahul at icerasemi dot com @ 2010-08-06 8:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rahul at icerasemi dot com 2010-08-06 08:01 -------
Confirmed, fix for PR41317 avoids forwarding ARRAY_REFs to their use and fixes
this issue. Does this fix hinder any optimizations?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45195
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-06 8:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 12:21 [Bug tree-optimization/45195] New: incorrect "array subscript above bounds" warning rahul at icerasemi dot com
2010-08-05 13:16 ` [Bug tree-optimization/45195] " rguenth at gcc dot gnu dot org
2010-08-06 8:02 ` rahul at icerasemi 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).