------- Comment #8 from pinskia at gmail dot com 2010-06-17 09:37 ------- Subject: Re: switch/case optimization produces an invalid lookup table index
I bet it could be reproduced on any target with -fshort-enums. On Jun 17, 2010, at 2:20 AM, "eblot dot ml at gmail dot com" <gcc-bugzi...@gcc.gnu.org > wrote: > > > ------- Comment #6 from eblot dot ml at gmail dot com 2010-06-17 > 09:20 ------- > (In reply to comment #5) >> Unfortunately I don't see this happening on the x86_64-linux -> >> arm-linux-gnueabi cross compiler I built for myself. The generated >> assembly has all four elements in the initialization of CSWTCH.2 and >> the intermediate tree dumps from the cross compiler are not really >> different from the ones from a native x86_64 compiler. > > I think this might be due to the ABI differences between the > official ARM ABI > (AAPCS) and the Linux variant, which is slightly different. > > I'd bet the way the enumerations are handled (variable size with > AAPCS, fixed, > integer-native size with ARM Linux) is the 'culprit' here. > > See http://www.codesourcery.com/sgpp/lite/arm/arm_gnu_linux_abi.pdf > > The enumeration used in this bug report is coded as a byte with > AAPCS, whereas > it should be coded as a 32-bit value with Linux ARM ABI. This might > explain why > you cannot reproduce the issue with a Linux-target cross-compiler. > > > -- > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44328 > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44328