[FFmpeg-devel] [PATCH] remove gcc 3.3 workaround in swscale_template.c

Diego Biurrun diego
Tue Sep 22 16:10:18 CEST 2009


On Tue, Sep 22, 2009 at 03:53:19PM +0200, Benoit Fouet wrote:
> On 2009-09-21 00:16, Diego Biurrun wrote:
> > On Sun, Sep 20, 2009 at 09:02:46PM +0200, Reimar D?ffinger wrote:
> >> On Sun, Sep 20, 2009 at 08:00:40PM +0200, Diego Biurrun wrote:
> >>> On Sun, Sep 20, 2009 at 07:12:44PM +0200, Reimar D?ffinger wrote:
> >>>> On Sun, Sep 20, 2009 at 06:53:36PM +0200, Diego Biurrun wrote:
> >>>>> There's an ugly preprocessor gcc 3.3 workaround in swscale_template.c:
> >>>>>
> >>>>>   /* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
> >>>>>      which is needed to support GCC 4.0. */
> >>>>>   #if ARCH_X86_64 && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
> >>>>>                   :: "m" (src1), "m" (dst), "g" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
> >>>>>   #else
> >>>>>                   :: "m" (src1), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
> >>>>>   #endif
> >>>>>
> >>>>> At the very least it should be updated to use the AV_GCC_VERSION_AT_LEAST
> >>>>> macro from libavutil.  However, I would prefer to get rid of it
> >>>>> completely.  If I understand the comment correctly, deleting the whole
> >>>>> #else clause would be the way to achieve this.  Since I know little
> >>>>> enough assembler to have no real idea what "g" and "m" operands are all
> >>>>> about I'd like to hear an informed opinion.
> >>>> Huh? No, the upper line should give faster code but causes crashes due
> >>>> to miscompilation with gcc 3.3
> >>>> The lower line does not compile with gcc 4.0 on x86_64 but produces correct code
> >>>> with 3.3.
> >>>> At least that's what the comment says.
> >>> OK, then I propose getting rid of the workaround completely.  I don't
> >>> think x86_64 users with gcc 3.3 exist, so it's not worth the ugliness on
> >>> our side.
> >> Hm? Which do you consider a workaround? I think you might still need two cases,
> >> one for x86_32 and one for x86_64 for gcc 4.x, you could only get rid of the
> >> gcc version check.
> > 
> > OK, I propose the attached patch.
> 
> which results in code as ugly, but with no support for gcc < 3.3 on x86_64

Excuse me, but how can 

  #if ARCH_X86_64

be as ugly as

  #if ARCH_X86_64 && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))

?

You must be deeply confused.

> I'd say, if you really want to change that code, change it to use
> AV_GCC_VERSION_AT_LEAST, and that should do, no ?

No, that only works for gcc, which sucks.  Also, we don't know if the
problem exists for gcc 3.3 only or for gcc <3.3 as well..

Note that this is the last occurrence of __GNUC__ outside of appropriate
places.

Diego



More information about the ffmpeg-devel mailing list