ソースを参照

disas/cris.c: Avoid unintentional sign extension

Commit 001ebaca7b11 fixed some unintended sign extension issues
spotted by Coverity (CID 1005402, 1005403), but didn't catch
all of them. Fix the rest, so we behave consistently whether
'long' is 32 bit or 64 bit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 1490970671-20560-1-git-send-email-peter.maydell@linaro.org
Peter Maydell 8 年 前
コミット
230f4c6bc5
1 ファイル変更2 行追加2 行削除
  1. 2 2
      disas/cris.c

+ 2 - 2
disas/cris.c

@@ -2048,7 +2048,7 @@ print_with_operands (const struct cris_opcode *opcodep,
 	  {
 	  {
 	    /* We're looking at [pc+], i.e. we need to output an immediate
 	    /* We're looking at [pc+], i.e. we need to output an immediate
 	       number, where the size can depend on different things.  */
 	       number, where the size can depend on different things.  */
-	    long number;
+	    int32_t number;
 	    int signedp
 	    int signedp
 	      = ((*cs == 'z' && (insn & 0x20))
 	      = ((*cs == 'z' && (insn & 0x20))
 		 || opcodep->match == BDAP_QUICK_OPCODE);
 		 || opcodep->match == BDAP_QUICK_OPCODE);
@@ -2290,7 +2290,7 @@ print_with_operands (const struct cris_opcode *opcodep,
 
 
 		    if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15)
 		    if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15)
 		      {
 		      {
-			long number;
+			int32_t number;
 			unsigned int nbytes;
 			unsigned int nbytes;
 
 
 			/* It's a value.  Get its size.  */
 			/* It's a value.  Get its size.  */