diff --git a/src/vm/interp/vm_tgc_c.cpp b/src/vm/interp/vm_tgc_c.cpp index 09d1480..14ff892 100644 --- a/src/vm/interp/vm_tgc_c.cpp +++ b/src/vm/interp/vm_tgc_c.cpp @@ -2187,12 +2187,11 @@ typename vm_base::virt_addr_t vm_impl::execute_inst(finish_cond_e co *NEXT_PC = *PC + 2; // execute instruction { - uint32_t offs = *(X+2) + uimm; - int32_t read_res = super::template read_mem(traits::MEM, offs); - if(this->core.trap_state) goto TRAP_CLWSP; - int32_t res = read_res; if(rd % traits::RFS) { - *(X+rd % traits::RFS) = res; + int32_t read_res = super::template read_mem(traits::MEM, *(X+2) + uimm); + if(this->core.trap_state) goto TRAP_CLWSP; + int32_t res = read_res; + *(X+rd % traits::RFS) = (int32_t)res; } else { raise(0, 2);