[binutils-gdb] ubsan: nios2: left shift cannot be represented in type 'int'

Alan Modra amodra@sourceware.org
Wed Dec 11 01:13:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=96f1f60460a87fa63c33e1004f2c98d30f686d8d

commit 96f1f60460a87fa63c33e1004f2c98d30f686d8d
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Dec 11 08:32:18 2019 +1030

    ubsan: nios2: left shift cannot be represented in type 'int'
    
    	* nios2-dis.c (nios2_print_insn_arg): Use 1u << 31.

Diff:
---
 opcodes/ChangeLog   | 4 ++++
 opcodes/nios2-dis.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 60dfe76..b36a9e2 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,9 @@
 2019-12-11  Alan Modra  <amodra@gmail.com>
 
+	* nios2-dis.c (nios2_print_insn_arg): Use 1u << 31.
+
+2019-12-11  Alan Modra  <amodra@gmail.com>
+
 	* moxie-dis.c (INST2OFFSET): Don't sign extend using shifts.
 
 2019-12-11  Alan Modra  <amodra@gmail.com>
diff --git a/opcodes/nios2-dis.c b/opcodes/nios2-dis.c
index 2d63eed..adf0091 100644
--- a/opcodes/nios2-dis.c
+++ b/opcodes/nios2-dis.c
@@ -867,7 +867,7 @@ nios2_print_insn_arg (const char *argptr,
 
 	  case iw_L5I4X1_type:
 	    /* Encoding for push.n/pop.n.  */
-	    reglist |= (1 << 31);
+	    reglist |= (1u << 31);
 	    if (GET_IW_L5I4X1_FP (opcode))
 	      reglist |= (1 << 28);
 	    if (GET_IW_L5I4X1_CS (opcode))



More information about the Binutils-cvs mailing list