[PATCH] D138781: [RISCV] Check missed Expected<T> result

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 00:36:56 PST 2022


jrtc27 accepted this revision.
jrtc27 added inline comments.


================
Comment at: llvm/test/ExecutionEngine/JITLink/RISCV/ELF_pc_indirect.s:49
+        auipc a0, %pcrel_hi(external_data)
+        sw  a0, %pcrel_lo(test_pcrel32_s)(a0)
+
----------------
dkurt wrote:
> jrtc27 wrote:
> > Why is this a test for the case you're fixing? This is valid input so shouldn't be hitting an error path in the first place.
> Actually, no error is expected. Without changes in ELF_riscv.cpp LLVM throws 
> ```
> Expected<T> must be checked before access or destruction.
> Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed).
> ```
> because result `RelHI20` wrapped to Expected<T> is correct but not checked for the potential error.
Oh ok, the context makes this clearer, I thought it was code shared with the _I form but no. Thanks for the clarification.


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

https://reviews.llvm.org/D138781



More information about the llvm-commits mailing list