public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/42577]  New: array bounds false positive with -O3, goes away with -O2
@ 2010-01-01 21:01 matt at use dot net
  2010-01-01 21:02 ` [Bug middle-end/42577] " matt at use dot net
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: matt at use dot net @ 2010-01-01 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

when building ScummVM (http://scummvm.org) using GCC 4.4.1 on Ubuntu
9.10/amd64:
matt@ghuang-desktop:~/src/scummvm$ g++-4.4
-Wp,-MMD,"engines/saga/.deps/animation.d",-MQ,"engines/saga/animation.o",-MP
-Wall -Werror -g -ansi -W -Wno-unused-parameter -Wno-empty-body -pedantic
-Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
-fno-strict-aliasing  -Wpointer-arith -Wcast-qual -Wcast-align -Wshadow
-Wimplicit -Wnon-virtual-dtor -Wwrite-strings -fno-rtti -fno-exceptions
-fcheck-new -O3 -Wuninitialized -DSCUMMVM_SVN_REVISION=\"46563\"
-DHAVE_CONFIG_H -DUNIX -DDATA_PATH=\"/usr/local/share/scummvm\"
-DPLUGIN_DIRECTORY=\"/usr/local/lib/scummvm\" -DSDL_BACKEND
-DENABLE_SCUMM=STATIC_PLUGIN -DENABLE_SCUMM_7_8 -DENABLE_HE
-DENABLE_AGI=STATIC_PLUGIN -DENABLE_AGOS=STATIC_PLUGIN -DENABLE_AGOS2
-DENABLE_CINE=STATIC_PLUGIN -DENABLE_CRUISE=STATIC_PLUGIN
-DENABLE_DRACI=STATIC_PLUGIN -DENABLE_DRASCULA=STATIC_PLUGIN
-DENABLE_GOB=STATIC_PLUGIN -DENABLE_GROOVIE=STATIC_PLUGIN -DENABLE_GROOVIE2
-DENABLE_KYRA=STATIC_PLUGIN -DENABLE_LOL -DENABLE_LURE=STATIC_PLUGIN
-DENABLE_M4=STATIC_PLUGIN -DENABLE_MADE=STATIC_PLUGIN
-DENABLE_PARALLACTION=STATIC_PLUGIN -DENABLE_QUEEN=STATIC_PLUGIN
-DENABLE_SAGA=STATIC_PLUGIN -DENABLE_IHNM -DENABLE_SAGA2
-DENABLE_SCI=STATIC_PLUGIN -DENABLE_SCI32 -DENABLE_SKY=STATIC_PLUGIN
-DENABLE_SWORD1=STATIC_PLUGIN -DENABLE_SWORD2=STATIC_PLUGIN
-DENABLE_TEENAGENT=STATIC_PLUGIN -DENABLE_TINSEL=STATIC_PLUGIN
-DENABLE_TOUCHE=STATIC_PLUGIN -DENABLE_TUCKER=STATIC_PLUGIN -I. -I. -I./engines
-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -c engines/saga/animation.cpp
cc1plus: warnings being treated as errors
./engines/saga/animation.h: In member function ‘int
Saga::Anim::playCutaway(int, bool)’:
./engines/saga/animation.h:175: error: array subscript is above array bounds

Relevant code in question:
#define MAX_ANIMATIONS 10
AnimationData *_animations[MAX_ANIMATIONS];

void validateAnimationId(uint16 animId) {
  if (animId >= MAX_ANIMATIONS) {
    // ...
  } else {
    if (_animations[animId] == NULL) {
      error("validateAnimationId: animId=%i unassigned.", animId);
    }
  }
}

pre-processed output is attached. This bug appears to already be fixed in GCC
4.5 snapshot as on 2009-12-28.


-- 
           Summary: array bounds false positive with -O3, goes away with -O2
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: matt at use dot net
 GCC build triplet: x86_64-linux-unknown
  GCC host triplet: x86_64-linux-unknown
GCC target triplet: x86_64-linux-unknown


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


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

end of thread, other threads:[~2010-04-30  8:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-01 21:01 [Bug middle-end/42577] New: array bounds false positive with -O3, goes away with -O2 matt at use dot net
2010-01-01 21:02 ` [Bug middle-end/42577] " matt at use dot net
2010-01-01 21:16 ` matt at use dot net
2010-01-01 22:42 ` rguenth at gcc dot gnu dot org
2010-01-02 14:57 ` rguenth at gcc dot gnu dot org
2010-01-02 16:41 ` [Bug middle-end/42577] [4.4/4.5 Regression] " rguenth at gcc dot gnu dot org
2010-01-02 16:42 ` rguenth at gcc dot gnu dot org
2010-01-02 19:15 ` [Bug middle-end/42577] [4.4 " rguenth at gcc dot gnu dot org
2010-01-02 19:15 ` [Bug middle-end/42577] [4.4/4.5 " rguenth at gcc dot gnu dot org
2010-01-03 19:58 ` [Bug middle-end/42577] [4.4 " matt at use dot net
2010-01-03 22:33 ` rguenth at gcc dot gnu dot org
2010-01-04  1:04 ` matt at use dot net
2010-01-04 14:26 ` rguenth at gcc dot gnu dot org
2010-01-17 17:39 ` rguenth at gcc dot gnu dot org
2010-01-21 13:18 ` jakub at gcc dot gnu dot org
2010-02-10  1:26 ` matt at use dot net
2010-04-30  9:01 ` jakub 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).