[Ffmpeg-devel] Re: [Ffmpeg-cvslog] r8420 - trunk/libavcodec/dv.c

Uoti Urpala uoti.urpala
Sun Mar 25 14:40:22 CEST 2007

On Sun, 2007-03-25 at 12:06 +0100, Guillaume POIRIER wrote:
> On 3/25/07, Roman Shaposhnik <rvs at sun.com> wrote:
> > On Fri, 2007-03-16 at 00:45 +0100, gpoirier wrote:
> > > -    assert((((int)block) & 7) == 0);
> > > +    assert((((int)block) & 15) == 0);
> >
> >   Are you sure this works? I see no way of aligning anything on the
> > x86 stack for more than 8. And even that is kind of iffy, given
> > that the x86 ABI mandates an alignment of 4.

The de facto ABI on current Linux is 16 byte stack alignment. On OS X
the 16 byte alignment requirement has been in the official ABI from the
start AFAIK.

> Yes, it works(tm) on the platform where I tested the patch before
> committing (intel/OSX 10.4.8)

As mentioned above, on OS X there shouldn't even be a chance of legacy
code working differently unless it's clearly buggy.

I think the only sane way to work with the current gcc is to assume that
the stack _will_ be 16-byte aligned inside FFmpeg. If there are problems
with that assumption on some platform (in practice I think that would
mainly be external applications calling the code on Windows) then work
around those by adding explicit stack aligning code (easiest done using
the gcc4.2+ features).

More information about the ffmpeg-devel mailing list