qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2] linux-user: limit check to HOST_LONG_BITS == 32


From: Peter Maydell
Subject: Re: [PATCH v2] linux-user: limit check to HOST_LONG_BITS == 32
Date: Thu, 21 May 2020 15:08:47 +0100

On Thu, 21 May 2020 at 14:58, Alex Bennée <address@hidden> wrote:
>
> Newer clangs rightly spot that you can never exceed the full address
> space of 64 bit hosts with:
>
>   linux-user/elfload.c:2076:41: error: result of comparison 'unsigned
>   long' > 18446744073709551615 is always false
>   [-Werror,-Wtautological-type-limit-compare]
>   4685         if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) {
>   4686             ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
>   4687 1 error generated.
>
> So lets limit the check to 32 bit hosts only.

> +#if HOST_LONG_BITS == 32
>          if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) {
>              error_report("%s: requires more virtual address space "
>                           "than the host can provide (0x%" PRIx64 ")",
>                           image_name, (uint64_t)guest_hiaddr - guest_base);
>              exit(EXIT_FAILURE);
>          }
> +#endif

Is this also a tautological compare in the host==32 && guest==32
case? Do we maybe want "#if HOST_LONG_BITS < TARGET_ABI_BITS" ?

thanks
-- PMM



reply via email to

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