[MPlayer-dev-eng] [PATCH] -fno-strict-aliasing on gcc > 3

Michael Niedermayer michaelni at gmx.at
Thu Jul 14 00:56:41 CEST 2005


Hi

On Wednesday 13 July 2005 22:28, Joerg Sonnenberger wrote:
> On Wed, Jul 13, 2005 at 09:48:57PM +0200, Michael Niedermayer wrote:
> > well, id say add -fno-strict-aliasing to the files which need it but
> > leave the rest for now
> > the real problem is again that gcc is crap, it is too silly to figure out
> > which pointers clearly cant alias each other (so that
> > -fno-strict-aliasing would be fast enough) and OTOH its to silly to
> > realize that a x= (float*)y means that both alias each other so either
> > way sucks, the programmer has to do what the compiler should do
>
> Actually, C is one of the very few languages which didn't *specify* the
> behaviour until very recently (ISO C99). For example, Fortran always had
> a rule of different types -- can't alias. There are a lot of very bad hacks
> which have been used before and which are the reason why char * is still
> allowed to alias anything.
>
> No, this doesn't mean a programmer has to do something the compiler could
> do. The programmer is clearly hacking around the supposed situation here.
> If you really want to read a float value as something else from the same
> address, use char *. That's allowed and often (e.g. on strict alignment

well, thats nice but has nothing to do with reality, the reason why something 
with type X is read as a different type is in many cases to perform some 
operation faster, now if they where read as chars that wouldnt be faster 
anymore ...

[...]
-- 
Michael




More information about the MPlayer-dev-eng mailing list