-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[next] SH: Use bitwise OR with mask for sign extension #2389
base: next
Are you sure you want to change the base?
[next] SH: Use bitwise OR with mask for sign extension #2389
Conversation
Sign extend using bitwise OR with mask, instead of unary minus. Fixes error when building for UWP with Security Development Lifecycle (SDL). See https://learn.microsoft.com/en-us/cpp/build/reference/sdl-enable-additional-security-checks?view=msvc-170
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though SH disassembler generates clang-tidy warnings:
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:102:9: warning: va_arg() is called on an uninitialized va_list [clang-analyzer-valist.Uninitialized]
grp = va_arg(g, sh_insn_group);
^
/usr/lib/llvm-14/lib/clang/14.0.0/include/stdarg.h:19:29: note: expanded from macro 'va_arg'
#define va_arg(ap, type) __builtin_va_arg(ap, type)
^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:100:9: note: Assuming 'n' is > 0
while (n > 0) {
^~~~~
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:100:2: note: Loop condition is true. Entering loop body
while (n > 0) {
^
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:102:9: note: va_arg() is called on an uninitialized va_list
grp = va_arg(g, sh_insn_group);
^
/usr/lib/llvm-14/lib/clang/14.0.0/include/stdarg.h:19:29: note: expanded from macro 'va_arg'
#define va_arg(ap, type) __builtin_va_arg(ap, type)
^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:937:4: warning: Value stored to 'insn' is never read [clang-analyzer-deadcode.DeadStores]
insn = SH_INS_JMP;
^ ~~~~~~~~~~
/home/runner/work/capstone/capstone/arch/SH/SHDisassembler.c:937:4: note: Value stored to 'insn' is never read
insn = SH_INS_JMP;
^ ~~~~~~~~~~
cc @Rot127
@lhsazevedo Please test it with |
@Rot127 clang-tidy 18 also warns about uninitialized va_args. Perhaps it is a bug in clang-tidy?
There are more warnings for SHDisassembler, but they all seem to be unrelated to this change |
Sorry, those AArch64 ones can be ignored. I fixed them in the AArch64 update. Just check the SH one please. |
@Rot127, I haven't had time to check the SH disassembler yet as the warnings are from a different part of the code. I'll get on it as soon as I can. Thanks for your patience! |
Cherry pick of #2371 to next branch