------- Comment #4 from kkojima at gcc dot gnu dot org 2008-10-26 08:26 ------- sh_reorg might insert a new mova in SH_FIXUP_PCLOAD phase. When untangle_mova looks this mova insn, it may not be associated with the insn address yet but the current code takes its undefined address. It seems that this mova should be skipped there because it will be handled later. I'm testing the attached patch.
-- * config/sh/sh.c (untangle_mova): Return -1 when NEW_MOVA has no address. --- ORIG/trunk/gcc/config/sh/sh.c 2008-10-22 09:11:15.000000000 +0900 +++ LOCAL/trunk/gcc/config/sh/sh.c 2008-10-26 10:36:59.000000000 +0900 @@ -3826,6 +3826,10 @@ untangle_mova (int *num_mova, rtx *first if (optimize) { + /* If NEW_MOVA has no address yet, it will be handled later. */ + if (INSN_ADDRESSES_SIZE() <= (unsigned) INSN_UID (new_mova)) + return -1; + n_addr = INSN_ADDRESSES (INSN_UID (new_mova)); n_target = INSN_ADDRESSES (INSN_UID (XEXP (MOVA_LABELREF (new_mova), 0))); if (n_addr > n_target || n_addr + 1022 < n_target) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37909