-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[compiler-rt] Fix format string warnings in FreeBSD DumpAllRegisters #101072
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
DimitryAndric
merged 1 commit into
llvm:main
from
DimitryAndric:sanitizer-common-fix-x86_64-format-1
Jul 29, 2024
Merged
[compiler-rt] Fix format string warnings in FreeBSD DumpAllRegisters #101072
DimitryAndric
merged 1 commit into
llvm:main
from
DimitryAndric:sanitizer-common-fix-x86_64-format-1
Jul 29, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On FreeBSD amd64 (aka x86_64), registers are always defined as `int64_t`, which in turn is equivalent to `long`. This leads to a number of warnings in `DumpAllRegisters()`: compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2245:31: warning: format specifies type 'unsigned long long' but the argument has type '__register_t' (aka 'long') [-Wformat] 2245 | Printf("rax = 0x%016llx ", ucontext->uc_mcontext.mc_rax); | ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %016lx compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2246:31: warning: format specifies type 'unsigned long long' but the argument has type '__register_t' (aka 'long') [-Wformat] 2246 | Printf("rbx = 0x%016llx ", ucontext->uc_mcontext.mc_rbx); | ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %016lx ... more of these ... Fix it by using the `lx` format.
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Dimitry Andric (DimitryAndric) ChangesOn FreeBSD amd64 (aka x86_64), registers are always defined as
Fix it by using the Full diff: https://github.com/llvm/llvm-project/pull/101072.diff 1 Files Affected:
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 2ea61b1cb424c..7b73c3576fd35 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -2386,25 +2386,25 @@ void SignalContext::DumpAllRegisters(void *context) {
# elif SANITIZER_FREEBSD
# if defined(__x86_64__)
Report("Register values:\n");
- Printf("rax = 0x%016llx ", ucontext->uc_mcontext.mc_rax);
- Printf("rbx = 0x%016llx ", ucontext->uc_mcontext.mc_rbx);
- Printf("rcx = 0x%016llx ", ucontext->uc_mcontext.mc_rcx);
- Printf("rdx = 0x%016llx ", ucontext->uc_mcontext.mc_rdx);
+ Printf("rax = 0x%016lx ", ucontext->uc_mcontext.mc_rax);
+ Printf("rbx = 0x%016lx ", ucontext->uc_mcontext.mc_rbx);
+ Printf("rcx = 0x%016lx ", ucontext->uc_mcontext.mc_rcx);
+ Printf("rdx = 0x%016lx ", ucontext->uc_mcontext.mc_rdx);
Printf("\n");
- Printf("rdi = 0x%016llx ", ucontext->uc_mcontext.mc_rdi);
- Printf("rsi = 0x%016llx ", ucontext->uc_mcontext.mc_rsi);
- Printf("rbp = 0x%016llx ", ucontext->uc_mcontext.mc_rbp);
- Printf("rsp = 0x%016llx ", ucontext->uc_mcontext.mc_rsp);
+ Printf("rdi = 0x%016lx ", ucontext->uc_mcontext.mc_rdi);
+ Printf("rsi = 0x%016lx ", ucontext->uc_mcontext.mc_rsi);
+ Printf("rbp = 0x%016lx ", ucontext->uc_mcontext.mc_rbp);
+ Printf("rsp = 0x%016lx ", ucontext->uc_mcontext.mc_rsp);
Printf("\n");
- Printf(" r8 = 0x%016llx ", ucontext->uc_mcontext.mc_r8);
- Printf(" r9 = 0x%016llx ", ucontext->uc_mcontext.mc_r9);
- Printf("r10 = 0x%016llx ", ucontext->uc_mcontext.mc_r10);
- Printf("r11 = 0x%016llx ", ucontext->uc_mcontext.mc_r11);
+ Printf(" r8 = 0x%016lx ", ucontext->uc_mcontext.mc_r8);
+ Printf(" r9 = 0x%016lx ", ucontext->uc_mcontext.mc_r9);
+ Printf("r10 = 0x%016lx ", ucontext->uc_mcontext.mc_r10);
+ Printf("r11 = 0x%016lx ", ucontext->uc_mcontext.mc_r11);
Printf("\n");
- Printf("r12 = 0x%016llx ", ucontext->uc_mcontext.mc_r12);
- Printf("r13 = 0x%016llx ", ucontext->uc_mcontext.mc_r13);
- Printf("r14 = 0x%016llx ", ucontext->uc_mcontext.mc_r14);
- Printf("r15 = 0x%016llx ", ucontext->uc_mcontext.mc_r15);
+ Printf("r12 = 0x%016lx ", ucontext->uc_mcontext.mc_r12);
+ Printf("r13 = 0x%016lx ", ucontext->uc_mcontext.mc_r13);
+ Printf("r14 = 0x%016lx ", ucontext->uc_mcontext.mc_r14);
+ Printf("r15 = 0x%016lx ", ucontext->uc_mcontext.mc_r15);
Printf("\n");
# elif defined(__i386__)
Report("Register values:\n");
|
devnexen
approved these changes
Jul 29, 2024
llvmbot
pushed a commit
to llvmbot/llvm-project
that referenced
this pull request
Jul 29, 2024
…lvm#101072) On FreeBSD amd64 (aka x86_64), registers are always defined as `int64_t`, which in turn is equivalent to `long`. This leads to a number of warnings in `DumpAllRegisters()`: compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2245:31: warning: format specifies type 'unsigned long long' but the argument has type '__register_t' (aka 'long') [-Wformat] 2245 | Printf("rax = 0x%016llx ", ucontext->uc_mcontext.mc_rax); | ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %016lx compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2246:31: warning: format specifies type 'unsigned long long' but the argument has type '__register_t' (aka 'long') [-Wformat] 2246 | Printf("rbx = 0x%016llx ", ucontext->uc_mcontext.mc_rbx); | ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %016lx ... more of these ... Fix it by using the `lx` format. (cherry picked from commit 62bd08a)
tru
pushed a commit
to llvmbot/llvm-project
that referenced
this pull request
Jul 30, 2024
…lvm#101072) On FreeBSD amd64 (aka x86_64), registers are always defined as `int64_t`, which in turn is equivalent to `long`. This leads to a number of warnings in `DumpAllRegisters()`: compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2245:31: warning: format specifies type 'unsigned long long' but the argument has type '__register_t' (aka 'long') [-Wformat] 2245 | Printf("rax = 0x%016llx ", ucontext->uc_mcontext.mc_rax); | ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %016lx compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:2246:31: warning: format specifies type 'unsigned long long' but the argument has type '__register_t' (aka 'long') [-Wformat] 2246 | Printf("rbx = 0x%016llx ", ucontext->uc_mcontext.mc_rbx); | ~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %016lx ... more of these ... Fix it by using the `lx` format. (cherry picked from commit 62bd08a)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On FreeBSD amd64 (aka x86_64), registers are always defined as
int64_t
, which in turn is equivalent tolong
. This leads to a number of warnings inDumpAllRegisters()
:Fix it by using the
lx
format.