[AArch64] Clang incorrectly warns with %wX register constraints
| Bugzilla Link | 21270 |
| Resolution | FIXED |
| Resolved on | Jan 13, 2016 08:31 |
| Version | trunk |
| OS | All |
| CC | @ahatanak,@echristo,@jmolloy,@rengolin |
Extended Description
Hi,
The following function provokes a warning on Clang trunk, 3.5, and AppleClang based on 3.4:
void g(int one, int two) { long wide_two = two; asm ("%w0 %1" : "+r" (one), "+r"(wide_two)); }
/Users/jammol01/Code/test.c:3:25: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths] asm ("%w0 %1" : "+r" (one), "+r"(wide_two)); ^ /Users/jammol01/Code/test.c:3:13: note: use constraint modifier "w" asm ("%w0 %1" : "+r" (one), "+r"(wide_two)); ^~ %w1
Obviously this warning is wrong - the second parameter is of type long (64-bit). This spurious warning is affected by the type of "one" - if I change "one" to "wide_one" (64-bit extended version) and remove the %w qualifier, it compiles fine.
Cheers,
James
Committed fix in r228089.
I think the code in SemaStmtAsm.cpp:273-300, which looks for the constraint index, is not correct. I'm working on a patch to fix it.