From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5+) Gecko/20011012 Description of problem: Addressing a static const multi-dimensional array in an inherited class results in wrong code generation for the C++ frontend of gcc. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.Compile program testcase.cc from above URL with parameters -O2 -Wall -g 2.Run the binary: ./testcase 3. Actual Results: Output: 00 01 02 10 11 12 20 21 22 AA AA AA BA BA BA CA CA CA Expected Results: Output: 00 01 02 10 11 12 20 21 22 AA AB AC BA BB BC CA CB CC Additional info: Happens with the following compiler: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98) Workaround: Single-dimensional string array with computation of correct index. E.g. string strs[] = { "AA","AB","AC","BA","BB","BC","CA","CB","CC" }; Access now instead of strs[1][2] use: strs[1 * 3 + 2]
Created attachment 41048 [details] Testcase C++ Source
Works with gcc 3.2.