[FFmpeg-devel] FATE & Regressions (and PPC is broken)

Michael Niedermayer michaelni
Sun Mar 16 18:16:10 CET 2008


On Sun, Mar 16, 2008 at 01:03:50PM +0100, Vitor Sessak wrote:
> Hi
> 
> Michael Niedermayer wrote:
> > On Sun, Mar 16, 2008 at 10:25:50AM +0100, Vitor Sessak wrote:
> >> Michael Niedermayer wrote:
> >>> On Sun, Mar 16, 2008 at 12:25:41AM +0100, Vitor Sessak wrote:
> >>>> Hi
> >>>>
> >>>> Mike Melanson wrote:
> >>>>
> >>>> [...]
> >>>>
> >>>>> x86_32/icc:
> >>>>> This is weird; if I build icc and then run 'make test', it crashes here
> >>>>> (tried twice with a 'make clean' in between):
> >>>>> "/home/melanson/ffmpeg/build-icc"/tests/audiogen tests/asynth1.sw
> >>>>> Segmentation fault (core dumped)
> >>>>> make: *** [tests/asynth1.sw] Error 139
> >>>> This can be fixed with the following patch, but I don't know if it is the 
> >>>> right fix.
> >>> Could you shed some light on the question where it crashes and why the
> >>> patch fixes it?
> >>>
> >> In the code
> >>
> >>> static int int_cos(int a)
> >>> {
> >>>     int neg, v, f;
> >>>     const unsigned short *p;
> >>>
> >>>     a = a & (FRAC_ONE - 1); /* modulo 2 * pi */
> >>>     if (a >= (FRAC_ONE / 2))
> >>>         a = FRAC_ONE - a;
> >>>     neg = 0;
> >>>     if (a > (FRAC_ONE / 4)) {
> >>>         neg = -1;
> >>>         a = (FRAC_ONE / 2) - a;
> >>>     }
> >>>
> >>>     p = cos_table + (a >> CSHIFT);
> >> When a is negative, (a >> CSHIFT) can be negative (not only in icc but 
> >> in gcc too). So p[0] will dereference an invalid pointer.
> > 
> > a cannot be negative after
> > a = a & (FRAC_ONE - 1);
> 
> Well, that's the error. This line has no effect in icc with -O3.
> 
> Code:
> 
> > static int int_cos(int a)
> > {
> >     int neg, v, f;
> >     const unsigned short *p;
> > 
> >     printf("0: %d\n", a);
> >     a = a & (FRAC_ONE - 1); /* modulo 2 * pi */
> >     printf("1: %d\n", a);
> >     if (a >= (FRAC_ONE / 2))
> >         a = FRAC_ONE - a;
> >     printf("2: %d\n", a);
> >     neg = 0;
> >     if (a > (FRAC_ONE / 4)) {
> >         neg = -1;
> >         a = (FRAC_ONE / 2) - a;
> >     }
> >     printf("3: %d\n", a);
> > 
> >     if ((a >> CSHIFT) < 0)
> >         printf("4: error\n\n");
> >     else
> >         printf("4: ok\n\n");
> >     p = cos_table + (a >> CSHIFT);
> >     /* linear interpolation */
> >     f = a & ((1 << CSHIFT) - 1);
> >     v = p[0] + (((p[1] - p[0]) * f + (1 << (CSHIFT - 1))) >> CSHIFT);
> >     v = (v ^ neg) - neg;
> >     v = v << (FRAC_BITS - 15);
> >     return v;
> > }
> 
> icc -O3 output  |  gcc output
> 
> 0: 66127           0: 66127
> 1: 66127           1: 591
> 2: -591            2: 591
> 3: -591            3: 591
> 4: error           4: ok
> 
> Note that (FRAC_ONE - 1) == 65535. Is there any non ugly way to work 
> around this icc bug?

ask intel


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/20080316/a69ffa13/attachment.pgp>



More information about the ffmpeg-devel mailing list