Subject: Re: libxslt upgrade, please
To: None <pkgsrc-users@netbsd.org>
From: Christian Biere <christianbiere@gmx.de>
List: pkgsrc-users
Date: 01/20/2007 17:32:13
Joerg Sonnenberger wrote:
> On Sat, Jan 20, 2007 at 03:59:58PM +0100, Christian Biere wrote:
> > Joerg Sonnenberger wrote:
> > > On Sat, Jan 20, 2007 at 03:31:59PM +0100, Christian Biere wrote:
> > > > If there are such warnings, the flag should certainly be used. Even if
> > > > there are no warnings, the flag might still be required because the
> > > > compiler cannot detect all violations.
> > >
> > > I don't think that is true with GCC 4.1 any longer.
> >
> > Which part exactly?
>
> About GCC not detecting all cases when -fstrict-aliasing is active. The
> other part certainly is.
This is from gcc(1):
union a_union {
int i;
double d;
};
int main(void)
{
union a_union t;
int* ip;
t.d = 3.0;
ip = &t.i;
return *ip;
}
Even though the manpage says this code might not work as "expected" (whatever
one would expect here), I can't convince it to warn about this.
A common abuse looks more like this:
int main(void)
{
static char x[100];
int *ip = (int *)&x;
return *ip;
}
In this case, the compiler might notice the abuse and generate appropriate code
but if it's not in the same compile unit, this might not be possible.
--
Christian