public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [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

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