[libvirt] [PATCH] turn off strict-aliasing warnings in two files

Daniel P. Berrange berrange at redhat.com
Fri Feb 6 19:54:49 UTC 2009


On Fri, Feb 06, 2009 at 08:12:24PM +0100, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange at redhat.com> wrote:
> 
> > On Fri, Feb 06, 2009 at 07:31:46PM +0100, Jim Meyering wrote:
> >> Without these changes and with gcc-4.4,
> >> I'd get 4 warnings (2 in each file)
> >> about strict-aliasing violations.
> >> -Wstrict-aliasing is worth keeping in general, so I
> >> have disabled it only for the two offending files.
> >
> >
> > Can you show what lines / code trigger the warnings  and/r just
> > post the warnings themselves ?
> 
> bridge.c:657: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules
> bridge.c:658: warning: dereferencing pointer '({anonymous})' does break strict-aliasing rules
> qemud.c:671: warning: dereferencing pointer 'sa.72' does break strict-aliasing rules
> qemud.c:674: warning: dereferencing pointer 'sa.73' does break strict-aliasing rules

Oh, this is a little more scary that previous GCC warnings, which merely
say it 'might' break aliasing rules. GCC is clear here that it 'does' break
aliasing rules, so IMHO we need to change the code, rather than turn off 
the warning.

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