memset suggestion.

Andy Polyakov appro at fy.chalmers.se
Sat Nov 9 07:47:44 EST 2002


> > > > > Since 3.x is rolling out with -fno-builtin-<comand> support maybe we
> > > > > should test for 3.x and set -fno-builtin-memset which should stop gcc from
> > > > > optimizing it away.  And maybe everyone should look for the same feature
> > > > > in their favorite compiler.
> >
> > Why not pick and stick to a workaround that works with all compilers, is
> > independent on compiler flags and is safe at any optimization level? As
> > pointed out in my (sorry for quoting myself:-) submission to Bugtraq
> > http://online.securityfocus.com/archive/1/298835/2002-11-05/2002-11-11/0
> > that is.
> 
> Until the next round of optimizators come out that are smart enough to
> optimize that functional call out of existance.

Note that it's not functional call that is optimized away, but it's
inlined instantiation. It first gets inlined, *then* optimized away.
Inlining is the keyword! Real function call will never ever be optimized
away.

> Again we are left with a
> hack that may or may not stand the test of time.

Well, you might have hard time proving that such memset optimization is
actually a bug. But if you find guaranteed_memset optimized away, you
won't have *no* problem whatsoever proving that it's wrong and *demand*
the bug to be fixed. Even if guaranteed_memset gets inlined!

A.



More information about the openssh-unix-dev mailing list