================
@@ -737,11 +801,44 @@ class Executor {
   bool operator()(SH inst) { return Store<SH, uint16_t>(m_emu, inst); }
   bool operator()(SW inst) { return Store<SW, uint32_t>(m_emu, inst); }
   bool operator()(ADDI inst) {
-    return transformOptional(inst.rs1.ReadI64(m_emu),
-                             [&](int64_t rs1) {
-                               return inst.rd.Write(
-                                   m_emu, rs1 + int64_t(SignExt(inst.imm)));
-                             })
+    return transformOptional(
+               inst.rs1.ReadI64(m_emu),
+               [&](int64_t rs1) {
+                 int64_t result = rs1 + int64_t(SignExt(inst.imm));
----------------
rupprecht wrote:

Is this supposed to be uint64_t? I'm seeing this failure w/ ubsan: 
`lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp:807:40: 
runtime error: signed integer overflow: -9223372036854775808 + -16 cannot be 
represented in type 'int64_t' (aka 'long')`

This is fine: `uint64_t result = rs1 + uint64_t(SignExt(inst.imm));`

https://github.com/llvm/llvm-project/pull/159842
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to