[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:10:22 PDT 2023


https://github.com/xingxue-ibm created https://github.com/llvm/llvm-project/pull/69767

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.

>From 2255e2c9a66420bba36bf4ba7f3d8db36d7e4dfc Mon Sep 17 00:00:00 2001
From: Xing Xue <xingxue at outlook.com>
Date: Fri, 20 Oct 2023 15:54:56 -0400
Subject: [PATCH] Add static_cast for the value from getLR() to avoid the
 warning from -Wconversion when it is in 32-bit mode.

---
 libunwind/src/UnwindCursor.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 {



More information about the cfe-commits mailing list