[MPlayer-dev-eng] [PATCH] fixes for gcc4

Michael Niedermayer michaelni at gmx.at
Sun Feb 27 01:04:45 CET 2005


Hi

On Sunday 27 February 2005 00:07, D Richard Felker III wrote:
> On Sat, Feb 26, 2005 at 10:56:50PM +0100, Michael Niedermayer wrote:
> > Hi
> >
> > On Friday 25 February 2005 20:43, Gianluigi Tiesi wrote:
> > > Updated patches to be compatible with gcc-2.95
> > >
> > > +       int ptr;
> >
> > very missleading name (an integer with name ptr)
> >
> > > +               ptr = ((int) src) + filterSize;
> >
> > u do not know if a pointer will fit in an int, if it doesnt this will
> > fail
> >
> > > -               :: "r" (src), "m" (dst), "m" (dstWidth), "m"
> > > (xInc>>16),
> >
> > "m" (xInc&0xFFFF)
> >
> > > +               :: "r" (src), "m" (dst), "m" (dstWidth), "m" (x1), "m"
> > > (x2)
> >
> > this is significantly less readable, theres no hope that anyone could
> > guess from the names x1 and x2 what they are
> >
> >
> > furthermore theres the fundamental question why exactly every project
> > which uses asm should rewrite their code for gcc 4, this is not about
> > correct or incorrect code, its practically just a syntax change
> > the changes gcc 4 needs makes the code much harder to read, harder to
> > optimize for the compiler and much longer
> >
> > is there some bugreport on gccs bugtracker about this? its breaking code
> > which was valid in the past
>
> imo "m" is an invalid constraint for things like "(xInc>>16)" which
> are not an lvalue and obviously don't have an address. apparently old
> versions of gcc just ignored the "m" and treated this as "r"...or did

no it was never treated as "r"


> they have some other hack to work with it? 

yes, they putted the result of the expression on the stack and used that, 
which is exactly what the patch does but its significantly less readable


> in any case, replacing "m" 
> with "r" seems like the sanest alternative.

unless u run out of registers or gccs register allocator runs out of whatever 
it uses


also keep "g" in mind (register or memory) in this case we need to put it 
redundantly on the stack with the new rules, and hope that gcc can figure out 
that nothing uses the thing from the stack

[...]
-- 
Michael

"nothing is evil in the beginning. Even Sauron was not so." -- Elrond




More information about the MPlayer-dev-eng mailing list