id,summary,reporter,owner,description,type,status,priority,component,version,resolution,keywords,cc,game 4011,SAGA: Compiler warnings; possibly an engine bug,eriktorbjorn,bluegr,"{{{#!Markdown Current ScummVM SVN While compiling ScummVM with the -O2 option, I encountered the following warning: ./engines/saga/animation.h: In member function ‘int Saga::Anim::playCutaway\(int, bool\)’: ./engines/saga/animation.h:173: warning: array subscript is above array bounds ./engines/saga/animation.h:173: warning: array subscript is above array bounds Part of the problem is the validateAnimationsId\(\) function in animation.h, which does if \(animId >= MAX\_ANIMATIONS\) \{ ... animId is a cutaway animation id \} if \(\_animations\[animId\] == NULL\) \{ error\( ... \); \} Changing that to ""\} else if \(\_animations\[animId\] == NULL\) \{"" brings up the next set of warnings: ./engines/saga/animation.h: In member function ‘int Saga::Anim::playCutaway\(int, bool\)’: ./engines/saga/animation.h:188: warning: array subscript is above array bounds ./engines/saga/animation.h:188: warning: array subscript is above array bounds This time, it's the getAnimation\(\) function that's the culprit. It says: if \(animId > MAX\_ANIMATIONS\) return \_cutawayAnimations\[animId - MAX\_ANIMATIONS\]; return \_animations\[animId\]; Shouldn't that be ""if \(animId >= MAX\_ANIMATIONS\)"" instead? Changing that still leaves me with a warning: ./engines/saga/animation.h: In member function ‘int Saga::Anim::playCutaway\(int, bool\)’: ./engines/saga/animation.h:172: warning: array subscript is above array bounds And this time I'm at a complete loss. Because now the validateAnimationId\(\) function reads: if \(animId >= MAX\_ANIMATIONS\) \{ ... \} else if \(\_animations\[animId\] == NULL\) \{ ... \} It's the ""else if"" it complains about, but I can't see why. It's the call to setFrameTime\(\) in playCutaway\(\) that seems to trigger it. }}} {{{#!div style=""font-size: 75%"" Ticket imported from: !#2284298. Ticket imported from: bugs/4011. }}}",defect,closed,normal,Engine: SAGA,,fixed,,,