[libvirt] [PATCH] Avoid cast to unit64_t on 32bit platform

Eric Blake eblake at redhat.com
Mon Feb 11 20:12:28 UTC 2013


On 02/11/2013 12:40 PM, Guido Günther wrote:
> Fixes compilation on 32bit platforms:
> 
> xen/xen_hypervisor.c: In function 'virXen_setvcpumap':
> xen/xen_hypervisor.c:1785:35: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
> xen/xen_hypervisor.c:1785:22: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> cc1: all warnings being treated as errors
> ---
>  src/xen/xen_hypervisor.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
> index 9b7dd2e..e3de0b2 100644
> --- a/src/xen/xen_hypervisor.c
> +++ b/src/xen/xen_hypervisor.c
> @@ -1782,7 +1782,7 @@ virXen_setvcpumap(int handle,
>          memset(&xen_cpumap, 0, sizeof(cpumap_t));
>          for (j = 0; j < maplen; j++) {
>              if ((j & 7) == 0)
> -                pm = (uint64_t *)((uint64_t)&xen_cpumap + (j & ~0x7UL));
> +                pm = (uint64_t *)((intptr_t)&xen_cpumap + (j & ~0x7UL));

I was afraid of this.  :(

I would ask that we hold off on this patch, and instead use a PROPER
patch that quits violating aliasing constraints.  I'll hopefully have
one posted later today (if not, then we can push this to fix builds as
an interim measure, but it feels lousy already having 2, and this would
make 3, patches to clean up what was supposed to be a simple Coverity
cleanup original patch).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130211/c3312f27/attachment-0001.sig>


More information about the libvir-list mailing list