[libunwind] [libunwind][AIX] static_cast the value from getLR() to avoid the warning from -Wconversion (PR #69767)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 13:11:24 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libunwind

Author: None (xingxue-ibm)

<details>
<summary>Changes</summary>

This PR adds `static_cast` to the value returned from `getLR()` in the AIX unwinder to avoid warning if `-Wconversion` is specified for building in 32-bit mode.

---
Full diff: https://github.com/llvm/llvm-project/pull/69767.diff


1 Files Affected:

- (modified) libunwind/src/UnwindCursor.hpp (+1-1) 


``````````diff
diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index f89c5b2c2f73e33..647a5a9c9d92d91 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -2404,7 +2404,7 @@ int UnwindCursor<A, R>::stepWithTBTable(pint_t pc, tbtable *TBTable,
     if (!TBTable->tb.saves_lr && registers.getLR()) {
       // This case should only occur if we were called from a signal handler
       // and the signal occurred in a function that doesn't save the LR.
-      returnAddress = registers.getLR();
+      returnAddress = static_cast<pint_t>(registers.getLR());
       _LIBUNWIND_TRACE_UNWINDING("Use saved LR=%p",
                                  reinterpret_cast<void *>(returnAddress));
     } else {

``````````

</details>


https://github.com/llvm/llvm-project/pull/69767


More information about the cfe-commits mailing list