From patchwork Fri Aug 10 00:45:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [rl78] add some checks Date: Thu, 09 Aug 2012 14:45:32 -0000 From: DJ Delorie X-Patchwork-Id: 176303 Message-Id: <201208100045.q7A0jWm9016705@greed.delorie.com> To: gcc-patches@gcc.gnu.org RTL checking pointed out a couple of cases where rl78.c was extracting info from rtx without checking the rtx type first. Applied. 2012-08-09 DJ Delorie * config/rl78/rl78.c (rl78_alloc_physical_registers): Check for SET before extracting SET_SRC. (rl78_remove_unused_sets): Check for REG before extractnig REGNO. Index: config/rl78/rl78.c =================================================================== --- config/rl78/rl78.c (revision 190277) +++ config/rl78/rl78.c (working copy) @@ -2217,7 +2217,8 @@ && GET_CODE (PATTERN (insn)) != CALL) continue; - if (GET_CODE (SET_SRC (PATTERN (insn))) == ASM_OPERANDS) + if (GET_CODE (PATTERN (insn)) == SET + && GET_CODE (SET_SRC (PATTERN (insn))) == ASM_OPERANDS) continue; valloc_method = get_attr_valloc (insn); @@ -2644,7 +2645,7 @@ dest = SET_DEST (insn); - if (REGNO (dest) > 23) + if (GET_CODE (dest) != REG || REGNO (dest) > 23) continue; if (find_regno_note (insn, REG_UNUSED, REGNO (dest)))