Re: [PATCH kvm-unit-tests 1/2] tsc: fix build error

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

 



On 16.07.2018 07:45, Peter Xu wrote:
> Fix the following build error:
> 
> x86/tsc.c: In function ‘test_rdpid’:
> x86/tsc.c:40:34: error: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘u64’ {aka ‘long unsigned int’} [-Werror=format=]
>         report("Test rdpid %%eax %d", eax == aux, aux);
>                                  ~^               ~~~
>                                  %ld
> 
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
> ---
>  x86/tsc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/x86/tsc.c b/x86/tsc.c
> index 2c484f6..06ecb81 100644
> --- a/x86/tsc.c
> +++ b/x86/tsc.c
> @@ -37,7 +37,7 @@ void test_rdpid(u64 aux)
>  
>         wrmsr(MSR_TSC_AUX, aux);
>         asm (".byte 0xf3, 0x0f, 0xc7, 0xf8" : "=a" (eax));
> -       report("Test rdpid %%eax %d", eax == aux, aux);
> +       report("Test rdpid %%eax %ld", eax == aux, aux);

Does this work for both, 32-bit and 64-bit binaries? If not, you might
need to use PRId64 here instead.

 Thomas



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux