Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
02747 Compiling Minor Always Dec 18, 2008, 17:11 Dec 25, 2008, 01:40
Tester qmc2 View Status Public Platform SDLMAME
Assigned To aaron Resolution Fixed OS Linux
Status [?] Resolved Driver
Version 0.128u6 Fixed in Version 0.129 Build I686
Summary 02747: Compile error on openSUSE 11.1 / gcc 4.3.2 with OPTIMIZE=3
Description On openSUSE 11.1 (32-bit) I get the following error (warning, treated as an error) with OPTIMIZE=3:

Compiling src/emu/input.c...
cc1: warnings being treated as errors
src/emu/input.c: In function ‘input_device_add’:
src/emu/input.c:1664: error: array subscript is below array bounds
make: *** [obj/sdl/mame/emu/input.o] Error 1

It works with OPTIMIZE=0, though.

Quoting couriersud:

"Here is the offending code:

int symmetric = (colnum >= 5);
UINT8 val = map->map[rownum][symmetric ? (8 - colnum) : (colnum - 1)];

And it is not a compiler bug. For colnum==0 val=map->map[rownum][0 ? 8 : -1]."
Steps To Reproduce Simply use a standard compile for 32-bit (no make options) - not sure about 64-bit builds, though. The 64-bit build worked fine on openSUSE 11.0 at least (gcc 4.3.1).
Additional Information GCC version:

$ gcc -v
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3
--enable-ssp --disable-libssp --with-bugurl=
--with-pkgversion='SUSE Linux' --disable-libgcj --disable-libmudflap
--with-slibdir=/lib --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --program-suffix=-4.3
--enable-linux-futex --without-system-libunwind --with-cpu=generic
Thread model: posix
gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux)
Regression Version
Affected Sets / Systems
Attached Files
There are no relationship linked to this issue.
User avatar
Dec 25, 2008, 01:38
Yes, it is a compiler bug. The offending case can never happen because you only get into that situation if (*mapstring == 0 || *mapstring == '.'). This exact same condition is checked previously, and a different path taken, so you will never hit it for the first character (colnum == 0).
User avatar
Dec 25, 2008, 01:40
I went ahead and added an extra check to make the compiler happy. It is a tricky situation for the compiler to evaluate.