Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

xingxue-ibm
Copy link
Contributor

@xingxue-ibm xingxue-ibm commented Oct 20, 2023

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

@xingxue-ibm xingxue-ibm requested a review from daltenty October 20, 2023 20:10
@xingxue-ibm xingxue-ibm self-assigned this Oct 20, 2023
@xingxue-ibm xingxue-ibm requested a review from a team as a code owner October 20, 2023 20:10
@llvmbot
Copy link
Member

llvmbot commented Oct 20, 2023

@llvm/pr-subscribers-libunwind

Author: None (xingxue-ibm)

Changes

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 --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 {

Copy link
Member

@daltenty daltenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@xingxue-ibm xingxue-ibm merged commit 7c651a1 into llvm:main Oct 24, 2023
@xingxue-ibm xingxue-ibm deleted the add-static-cast branch October 24, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants