public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/39974] [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code
  2009-04-30  9:15 [Bug tree-optimization/39974] New: [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code reichelt at gcc dot gnu dot org
@ 2009-04-30  9:15 ` reichelt at gcc dot gnu dot org
  2009-05-05 15:51 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2009-04-30  9:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0


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


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

* [Bug tree-optimization/39974]  New: [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code
@ 2009-04-30  9:15 reichelt at gcc dot gnu dot org
  2009-04-30  9:15 ` [Bug tree-optimization/39974] " reichelt at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2009-04-30  9:15 UTC (permalink / raw)
  To: gcc-bugs

The following code snippet produces a bogus warning when compiled with
"-O2 -Wall" on trunk:

bug.cc: In function 'void
_Z41__static_initialization_and_destruction_0ii.clone.0()':
bug.cc:3: warning: array subscript is below array bounds
bug.cc:3: warning: array subscript is below array bounds
bug.cc:3: warning: array subscript is below array bounds

Maybe the warning indicates a code generation bug.

Interestingly, the second array must contain at least 42 elements ;-)

==================================================================
#include<string>

std::string x[2][3] = { { "", "", "" }, { "", "", "" } };

struct A
{
  A(int);
};

struct B
{
  A a1, a2, a3, a4, a5, a6;
};

B b[42] =
{
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 }
};
==================================================================


-- 
           Summary: [4.5 regression] Bogus "array subscript is below array
                    bounds" warning in compiler generated code
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug tree-optimization/39974] [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code
  2009-04-30  9:15 [Bug tree-optimization/39974] New: [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code reichelt at gcc dot gnu dot org
  2009-04-30  9:15 ` [Bug tree-optimization/39974] " reichelt at gcc dot gnu dot org
@ 2009-05-05 15:51 ` mmitchel at gcc dot gnu dot org
  2009-05-05 22:00 ` reichelt at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2009-05-05 15:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug tree-optimization/39974] [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code
  2009-04-30  9:15 [Bug tree-optimization/39974] New: [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code reichelt at gcc dot gnu dot org
  2009-04-30  9:15 ` [Bug tree-optimization/39974] " reichelt at gcc dot gnu dot org
  2009-05-05 15:51 ` mmitchel at gcc dot gnu dot org
@ 2009-05-05 22:00 ` reichelt at gcc dot gnu dot org
  2009-06-22  0:43 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2009-05-05 22:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from reichelt at gcc dot gnu dot org  2009-05-05 22:00 -------
Here's a reduced version without includes:

===============================================
struct X
{
  X(int, const int& = 0);
  ~X();
};

X x[2][3] = { { 0, 0, 0 }, { 0, 0, 0 } };

struct A
{
  A(int);
};

struct B
{
  A a1, a2, a3, a4, a5, a6;
};

B b[42] =
{
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0 }
};
===============================================


-- 


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


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

* [Bug tree-optimization/39974] [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code
  2009-04-30  9:15 [Bug tree-optimization/39974] New: [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-05-05 22:00 ` reichelt at gcc dot gnu dot org
@ 2009-06-22  0:43 ` pinskia at gcc dot gnu dot org
  2009-09-18  4:17 ` pinskia at gcc dot gnu dot org
  2009-09-28 20:11 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-06-22  0:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2009-06-22 00:43 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-06-22 00:43:26
               date|                            |


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


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

* [Bug tree-optimization/39974] [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code
  2009-04-30  9:15 [Bug tree-optimization/39974] New: [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2009-06-22  0:43 ` pinskia at gcc dot gnu dot org
@ 2009-09-18  4:17 ` pinskia at gcc dot gnu dot org
  2009-09-28 20:11 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-09-18  4:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-09-18 04:17 -------
This works on the trunk with:
gcc version 4.5.0 20090917 (experimental) [trunk revision 151808] (GCC) 


It did produce a warning with:
gcc version 4.5.0 20090706 (experimental) [trunk revision 149292] (GCC) 


-- 


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


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

* [Bug tree-optimization/39974] [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code
  2009-04-30  9:15 [Bug tree-optimization/39974] New: [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2009-09-18  4:17 ` pinskia at gcc dot gnu dot org
@ 2009-09-28 20:11 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-09-28 20:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-09-28 20:11 -------
Fixed so closing as such.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-09-28 20:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-30  9:15 [Bug tree-optimization/39974] New: [4.5 regression] Bogus "array subscript is below array bounds" warning in compiler generated code reichelt at gcc dot gnu dot org
2009-04-30  9:15 ` [Bug tree-optimization/39974] " reichelt at gcc dot gnu dot org
2009-05-05 15:51 ` mmitchel at gcc dot gnu dot org
2009-05-05 22:00 ` reichelt at gcc dot gnu dot org
2009-06-22  0:43 ` pinskia at gcc dot gnu dot org
2009-09-18  4:17 ` pinskia at gcc dot gnu dot org
2009-09-28 20:11 ` pinskia at gcc dot gnu dot 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).