[Lldb-commits] [lldb] 07d0ef3 - [LLDB][RISCV] Fix UndefinedBehaviorSanitizer in RISCVEmulatorTester

via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 20 20:57:26 PDT 2022


Author: Emmmer
Date: 2022-09-21T11:56:55+08:00
New Revision: 07d0ef306b74fbcede432ad3480d2f299c051a98

URL: https://github.com/llvm/llvm-project/commit/07d0ef306b74fbcede432ad3480d2f299c051a98
DIFF: https://github.com/llvm/llvm-project/commit/07d0ef306b74fbcede432ad3480d2f299c051a98.diff

LOG: [LLDB][RISCV] Fix UndefinedBehaviorSanitizer in RISCVEmulatorTester

Added: 
    

Modified: 
    lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp b/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp
index 2df2d08711a8a..2d0f40e31fcb4 100644
--- a/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp
+++ b/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp
@@ -250,10 +250,10 @@ void TestAtomic(RISCVEmulatorTester *tester, uint64_t inst, T rs1_val,
 
 TEST_F(RISCVEmulatorTester, TestAtomicSequence) {
   this->WritePC(0x0);
-  *(uint64_t *)this->memory = 0x100427af;        // lr.w	a5,(s0)
-  *(uint64_t *)(this->memory + 4) = 0x00079663;  // bnez	a5,12
-  *(uint64_t *)(this->memory + 8) = 0x1ce426af;  // sc.w.aq	a3,a4,(s0)
-  *(uint64_t *)(this->memory + 12) = 0xfe069ae3; // bnez	a3,-12
+  *(uint32_t *)this->memory = 0x100427af;        // lr.w	a5,(s0)
+  *(uint32_t *)(this->memory + 4) = 0x00079663;  // bnez	a5,12
+  *(uint32_t *)(this->memory + 8) = 0x1ce426af;  // sc.w.aq	a3,a4,(s0)
+  *(uint32_t *)(this->memory + 12) = 0xfe069ae3; // bnez	a3,-12
   ASSERT_TRUE(this->DecodeAndExecute(*(uint32_t *)this->memory, false));
   ASSERT_EQ(this->gpr.gpr[0], uint64_t(16));
 }


        


More information about the lldb-commits mailing list