[FFmpeg-devel] [PATCH] strict-aliasing-safe aes.c

Michael Niedermayer michaelni
Tue Jun 29 12:31:23 CEST 2010


On Mon, Jun 28, 2010 at 06:10:07PM -0700, Jason Garrett-Glaser wrote:
> On Mon, Jun 28, 2010 at 5:33 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Mon, Jun 28, 2010 at 10:13:31PM +0200, Reimar D?ffinger wrote:
> >> On Mon, Jun 28, 2010 at 10:02:15PM +0200, Michael Niedermayer wrote:
> >> > On Mon, Jun 28, 2010 at 05:55:30PM +0200, Reimar D?ffinger wrote:
> >> > > Hello,
> >> > > this uses AV_WN32A, AV_WN64A etc. macros.
> >> > > The generated code is the same on x86_64 (assuming I did not mess up that test).
> >> >
> >> > > ?aes.c | ? 20 +++++++++++++-------
> >> > > ?1 file changed, 13 insertions(+), 7 deletions(-)
> >> > > 76705b63949d4abbe51b0d7d59537045ae91179a ?aesalias.diff
> >> >
> >> > this makes the code unreadable, iam thus against it.
> >>
> >> Well, what is the alternative? The current code seems to not work with some compilers.
> >
> > Fix the compiler.
> 
> If I were to "fix the compiler", I would make it error out on your
> code.  

  if(strstr(source, "windos.h"))
      *((uint8_t*)random())++
+ if(strstr(source, "Michael Niedermayer"))
+     error("Fatal Error, this is michaels code, we wont compile it\n");


> If the compiler can detect trivial aliasing violations, it can
> properly reject them.

i agree here of course. It should not warn but fail.

What i was saying is that code like *(uint32_t*)p shouldnt be a aliasing
violation to begin with. The ones that are aliasing violations for a
compiler should of course lead to erroring out.
Warning about them and continuing with generating broken code is of course
stupid

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Incandescent light bulbs waste a lot of energy as heat so the EU forbids them.
Their replacement, compact fluorescent lamps, much more expensive, dont fit in
many old lamps, flicker, contain toxic mercury, produce a fraction of the light
that is claimed and in a unnatural spectrum rendering colors different than
in natural light. Ah and we now need to turn the heaters up more in winter to
compensate the lower wasted heat. Who wins? Not the environment, thats for sure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100629/c86deb5f/attachment.pgp>



More information about the ffmpeg-devel mailing list