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

Dmitry Kurtaev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 00:32:47 PST 2022


dkurt 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)
+
----------------
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.


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

https://reviews.llvm.org/D138781



More information about the llvm-commits mailing list