http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55146
Oleg Endo <olegendo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-01-30 CC| |kkojima at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> 2013-01-30 22:38:34 UTC --- I've checked this issue on rev. 195555 (GCC 4.8) and the extu.b insn is emitted for the test case. On the 4.7 branch, the error is present. There the code for the insn 'casesi_worker_1' seems to have a bug: Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 195590) +++ gcc/config/sh/sh.md (working copy) @@ -9093,7 +9093,8 @@ case QImode: if (ADDR_DIFF_VEC_FLAGS (diff_vec).offset_unsigned) return \"mov.b @(r0,%1),%0\;extu.b %0,%0\"; - return \"mov.b @(r0,%1),%0\"; + else + return \"mov.b @(r0,%1),%0\"; default: gcc_unreachable (); } However, that still doesn't fix the problem. For some reason 'offset_unsigned' is always zero and thus the insn doesn't get the chance to output the correct insn sequence. The macro 'CASE_VECTOR_SHORTEN_MODE' in sh.h which is supposed to set the 'offset_unsigned' field to non-zero looks exactly the same on 4.7 and 4.8, so I guess the bug must be somewhere else.