-
Notifications
You must be signed in to change notification settings - Fork 301
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
aarch64_multibinary.h: Fix -Wasm-operand-widths #286
Conversation
Hi @bsbernd. Why compiler are you using? And could you sign off the commit? Thanks! |
Compilation with clang gave warnings as per below. Arm64 is has a width of 64 bit and these warnings came up. In file included from igzip/aarch64/igzip_multibinary_aarch64_dispatcher.c:29: ./include/aarch64_multibinary.h:338:35: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths] asm("mrs %0, MIDR_EL1 " : "=r" (id)); ^ ./include/aarch64_multibinary.h:338:12: note: use constraint modifier "w" asm("mrs %0, MIDR_EL1 " : "=r" (id)); ^~ %w0 1 warning generated. In file included from mem/aarch64/mem_aarch64_dispatcher.c:29: ./include/aarch64_multibinary.h:338:35: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths] asm("mrs %0, MIDR_EL1 " : "=r" (id)); ^ ./include/aarch64_multibinary.h:338:12: note: use constraint modifier "w" asm("mrs %0, MIDR_EL1 " : "=r" (id)); ^~ %w0 1 warning generated. Signed-off-by: Bernd Schubert <bschubert@ddn.com>
9757075
to
1951de3
Compare
@pablodelara just signed it. And yeah, I had forgotten to write that it happens with clang - also updated the commit message. |
Hmm, interesting that it is a actually a 32bit register |
I tried to grep through linux kernel code a bit, I think it resolves to
So also 64bit |
In glibc
So I think my patch is correct (I'm typically not working on assembler level, though). |
@liuqinfei could you review this PR? Thanks! |
A different version of the register description was found. And only the lower 32 bits of the register are valid. SO, for some platform the register is thought to be 64 bit. So, this may be the reason what the warning comes from. And according to the latest version, as you point out from the link, the register has been changed to a 32-bit version. Therefore, there is no truncation risk. |
@liuqinfei Yeah I think there is no risk with a 32 bit variable, but as glibc and linux kernel use a 64 bit variable there also should be no harm. |
Then the PR is fine. |
Apologies for the delay. This is merged now. |
No issue at all. Thank you @pablodelara. |
Compilation with clang gave warnings as per below.
Arm64 is has a width of 64 bit and these warnings came up.
In file included from igzip/aarch64/igzip_multibinary_aarch64_dispatcher.c:29: ./include/aarch64_multibinary.h:338:35: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
asm("mrs %0, MIDR_EL1 " : "=r" (id));
^
./include/aarch64_multibinary.h:338:12: note: use constraint modifier "w"
asm("mrs %0, MIDR_EL1 " : "=r" (id));
^~
%w0
1 warning generated.
In file included from mem/aarch64/mem_aarch64_dispatcher.c:29: ./include/aarch64_multibinary.h:338:35: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
asm("mrs %0, MIDR_EL1 " : "=r" (id));
^
./include/aarch64_multibinary.h:338:12: note: use constraint modifier "w"
asm("mrs %0, MIDR_EL1 " : "=r" (id));
^~
%w0
1 warning generated.