[Beignet] [PATCH 1/2] Fix shift-overflow warning

Yang, Rong R rong.r.yang at intel.com
Mon Sep 12 08:43:11 UTC 2016


The patchset LGTM, thanks, pushed.

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Giuseppe Bilotta
> Sent: Wednesday, September 7, 2016 20:13
> To: Beignet ML <beignet at lists.freedesktop.org>
> Cc: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
> Subject: [Beignet] [PATCH 1/2] Fix shift-overflow warning
> 
> Wrap toMB constant in UINT64_C to avoid the warning:
> 
>     src/cl_device_id.c:743:49: warning: result of
>      ‘1152921504606846975l << 20’
>      requires 81 bits to represent, but ‘long int’ only has 64 bits
>      [-Wshift-overflow=]
>         #define toMB(size) (size)&((0xfffffffffffffff)<<20)
> ---
>  src/cl_device_id.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/cl_device_id.c b/src/cl_device_id.c index 19eec5d..6b3b521
> 100644
> --- a/src/cl_device_id.c
> +++ b/src/cl_device_id.c
> @@ -740,7 +740,7 @@ kbl_gt4_break:
>    /* Apply any driver-dependent updates to the device info */
>    cl_driver_update_device_info(ret);
> 
> -  #define toMB(size) (size)&(0xfffffffffffffff<<20)
> +  #define toMB(size) (size)&(UINT64_C(0xfffffffffffffff)<<20)
>    /* Get the global_mem_size and max_mem_alloc size from
>     * driver, system ram and hardware*/
>    struct sysinfo info;
> --
> 2.8.1.372.g9612035
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list