public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "matt at use dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/42577]  New: array bounds false positive with -O3, goes away with -O2
Date: Fri, 01 Jan 2010 21:01:00 -0000	[thread overview]
Message-ID: <bug-42577-8137@http.gcc.gnu.org/bugzilla/> (raw)

[-- 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


             reply	other threads:[~2010-01-01 21:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-01 21:01 matt at use dot net [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-42577-8137@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).