llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[AArch64] Clang incorrectly warns with %wX register constraints

Open jmolloy opened this issue 12 years ago • 2 comments

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

jmolloy avatar Oct 14 '14 13:10 jmolloy

Committed fix in r228089.

ahatanak avatar Feb 04 '15 03:02 ahatanak

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.

ahatanak avatar Oct 15 '14 02:10 ahatanak