[Bug middle-end/42577] array bounds false positive with -O3, goes away with -O2

2010-01-01 Thread matt at use dot net


--- Comment #1 from matt at use dot net  2010-01-01 21:02 ---
Created an attachment (id=19439)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19439&action=view)
pre-processed output of the file that emitted the warning

commandline:
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 -E engines/saga/animation.cpp >
~/array-bounds-false-positive.i


-- 


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



[Bug middle-end/42577] array bounds false positive with -O3, goes away with -O2

2010-01-01 Thread matt at use dot net


--- Comment #2 from matt at use dot net  2010-01-01 21:16 ---
sorry, I lied. This is still an issue in GCC 4.5.20091228.


-- 


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



[Bug middle-end/42577] array bounds false positive with -O3, goes away with -O2

2010-01-01 Thread rguenth at gcc dot gnu dot org


--- Comment #3 from rguenth at gcc dot gnu dot org  2010-01-01 22:42 ---
The array indexing is done with D.25175_104, but

  D.25173_102 = (uint16) cutawaySlot_256;
  D.25174_103 = D.25173_102 + 10;
  D.25175_104 = (int) D.25174_103;
...
  if (D.25174_103 > 9)
goto ;
  else
goto ;

the actual check is done on D.25174_103.  We do not add asserts for
D.25175_104 on the edge to BB30.  D.25174 is unsigned short.

So we end up with

D.25173_102: [0, 1]
D.25174_103: [10, 11]
D.25175_104: [10, 11]

and warn for the access that is dominated by BB30.

So the issue is that we warn for dead code.


-- 


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



[Bug middle-end/42577] array bounds false positive with -O3, goes away with -O2

2010-01-02 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2010-01-02 14:57 ---
I have a patch.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
   |dot org |org
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2010-01-02 14:57:22
   date||


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