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

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 1 17:21:58 PDT 2020


aprantl marked an inline comment as done.
aprantl added inline comments.


================
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;
----------------
vsk wrote:
> 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
Am I misreading this or are we also setting the C(arry) flag inverted according to the documentation?


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

https://reviews.llvm.org/D80955





More information about the lldb-commits mailing list