From: Bob Wilson Date: Tue, 4 Jun 2013 06:10:09 +0000 (+0000) Subject: Rephrase asm_mismatched_size_modifier diagnostic. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4d2ea738175aacc7405e76a7e92b7e20f05519c6;p=clang Rephrase asm_mismatched_size_modifier diagnostic. The text of this diagnostic was unnecessarily specific to the current ARM implementation of validateConstraintModifier, and it gave a potentially confusing suggestion for fixing the problem. The ARM-specific issue is not a big deal since that is the only target that currently does any checking of asm operand modifiers, but until my change in 183172 it was still wrong for output operands in the way that it referred to the value being truncated when put into a register, since output operands are retrieved from the registers instead of being put into them. The bigger problem is that its suggestion to "use a modifier" is wrong and confusing in the case where a "q" modifier is incorrectly used with an "r" constraint. In that case, the solution might well be to remove the modifier or perhaps change the constraint. It's better to just leave the diagnostic message more generic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183209 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index d49457b1a5..a97e1cc355 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -5496,8 +5496,8 @@ let CategoryName = "Inline Assembly Issue" in { "accepted due to -fheinous-gnu-extensions, but clang may remove support " "for this in the future">; def warn_asm_mismatched_size_modifier : Warning< - "the value is truncated when put into register, " - "use a modifier to specify the size">, + "value size does not match register size specified by the constraint " + "and modifier">, InGroup; } diff --git a/test/CodeGen/arm-asm-diag.c b/test/CodeGen/arm-asm-diag.c index eea7920b10..bbf916d463 100644 --- a/test/CodeGen/arm-asm-diag.c +++ b/test/CodeGen/arm-asm-diag.c @@ -9,10 +9,10 @@ typedef struct int64x2x4_t { int64x2x4_t t1(const long long a[]) { int64x2x4_t r; __asm__("vldm %[a], { %q[r0], %q[r1], %q[r2], %q[r3] }" - : [r0] "=r"(r.val[0]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}} - [r1] "=r"(r.val[1]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}} - [r2] "=r"(r.val[2]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}} - [r3] "=r"(r.val[3]) // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}} + : [r0] "=r"(r.val[0]), // expected-warning {{value size does not match register size specified by the constraint and modifier}} + [r1] "=r"(r.val[1]), // expected-warning {{value size does not match register size specified by the constraint and modifier}} + [r2] "=r"(r.val[2]), // expected-warning {{value size does not match register size specified by the constraint and modifier}} + [r3] "=r"(r.val[3]) // expected-warning {{value size does not match register size specified by the constraint and modifier}} : [a] "r"(a)); return r; } diff --git a/test/CodeGen/arm-asm-warn.c b/test/CodeGen/arm-asm-warn.c index dbcbb38a74..6112b19d28 100644 --- a/test/CodeGen/arm-asm-warn.c +++ b/test/CodeGen/arm-asm-warn.c @@ -23,10 +23,10 @@ typedef struct int64x2x4_t { int64x2x4_t t2(const long long a[]) { int64x2x4_t r; __asm__("vldm %[a], { %q[r0], %q[r1], %q[r2], %q[r3] }" - : [r0] "=r"(r.val[0]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}} - [r1] "=r"(r.val[1]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}} - [r2] "=r"(r.val[2]), // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}} - [r3] "=r"(r.val[3]) // expected-warning {{the value is truncated when put into register, use a modifier to specify the size}} + : [r0] "=r"(r.val[0]), // expected-warning {{value size does not match register size specified by the constraint and modifier}} + [r1] "=r"(r.val[1]), // expected-warning {{value size does not match register size specified by the constraint and modifier}} + [r2] "=r"(r.val[2]), // expected-warning {{value size does not match register size specified by the constraint and modifier}} + [r3] "=r"(r.val[3]) // expected-warning {{value size does not match register size specified by the constraint and modifier}} : [a] "r"(a)); return r; }