[libvirt] [PATCH 0/3] Fix aliasing rules warnings with gcc-4.4

Daniel P. Berrange berrange at redhat.com
Fri Feb 13 16:18:26 UTC 2009


On Fri, Feb 13, 2009 at 11:54:08AM +0000, Mark McLoughlin wrote:
> 
> Hi,
> 
> It seems gcc's strict aliasing rules got stricter with gcc-4.4.
> 
> The basic rule is that two pointers of different types can't be
> used to reference the same address in memory. One exception is
> using a char* and another is when different types are members
> of a union.
> 
> I've used unions to fix all the warnings I see with current
> CVS HEAD. I can't say I like the solution all that much, so
> if anyone has better ideas ...

For the proxy we could get around it by changing it so that we only had
one struct to use, just reading part of the struct to start with, and
then reading the remainder if needed.

For the socket stuff, I don't see any alternative, since the socket()
API basically requires that you have these horrible casts between the
different sockaddr structs.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list