[Lldb-commits] [PATCH] D80955: Fix UB in EmulateInstructionARM64.cpp

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 1 15:11:30 PDT 2020


vsk added a comment.

I should add: otherwise, this looks good!



================
Comment at: lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp:99
+  if (!overflow)
+    overflow |= !llvm::checkedAdd(*signed_sum, SInt(carry_in));
   uint64_t result = unsigned_sum;
----------------
The docs [1] say 'integer signed_sum = SInt(x) + SInt(y) + UInt(carry_in)', but I bet checkedAdd doesn't support that, and anyway carry_in is 1-bit so it doesn't matter.

[1] https://developer.arm.com/docs/ddi0596/e/shared-pseudocode-functions/shared-functionsinteger-pseudocode#impl-shared.AddWithCarry.3


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80955/new/

https://reviews.llvm.org/D80955





More information about the lldb-commits mailing list