qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] util/cacheinfo: Fix warning generated by clang


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH] util/cacheinfo: Fix warning generated by clang
Date: Sat, 1 Jul 2017 15:35:11 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 07/01/2017 03:30 PM, Peter Maydell wrote:
On 1 July 2017 at 23:20, Richard Henderson <address@hidden> wrote:
On 06/30/2017 08:39 AM, Pranith Kumar wrote:

Clang generates the following warning on aarch64 host:

    CC      util/cacheinfo.o
/home/pranith/qemu/util/cacheinfo.c:121:48: warning: value size does not
match register size specified by the constraint and modifier
[-Wasm-operand-widths]
          asm volatile("mrs\t%0, ctr_el0" : "=r"(ctr));
                                                 ^
/home/pranith/qemu/util/cacheinfo.c:121:28: note: use constraint modifier
"w"
          asm volatile("mrs\t%0, ctr_el0" : "=r"(ctr));
                             ^~
                             %w0


That is an absolutely stupid warning.  There's long precedent for the
compiler choosing the prefix for you based on the type of the argument.

Isn't that the problem? The type of the argument says "32 bits"
but the instruction here really wants 64 bits (MRS takes Xn, not Wn).

The warning is telling me to use %w to force Wn. So if the assembler really doesn't like Wn, the warning is a bit more than confusing.

Perhaps it ought to be telling me to use %x to force Xn in spite of the type?


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]