[Numpy-discussion] strict aliasing?
Charles R Harris
Mon May 5 01:52:57 CDT 2008
On Sun, May 4, 2008 at 11:16 PM, David Cournapeau <
> Charles R Harris wrote:
> > As far as I can tell, strict aliasing assumes that pointers are only
> > cast between types of the same length.
> Strictly speaking, strict aliasing just says that locations pointed by
> pointers do not alias. If you use two pointers of different types,
> that's one case where the compiler will always assume they do not alias.
Interesting article. I note that it is OK to alias pointers to the signed
and unsigned versions of integer types, which is where I must have picked up
my notions about length. I don't recall seeing any major bit of software
that didn't use the -fno-strict-aliasing flag, as casting pointers around is
one of the things C is(was) all about. So I was a bit surprised that Mike
was recommending not doing so, although making the choice on a file by file
basis might be useful for the optimizer. But the assumption of pointers and
aliasing is so built into the whole C outlook that I wouldn't be surprised
if any large program developed obscure bugs when compiled with the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion