[Cbe-oss-dev] [HACK 1:9] spufs: Workaround gcc (4.1.1) problem with __weak 'empty' functions
Ulrich Weigand
Ulrich.Weigand at de.ibm.com
Sat May 31 00:35:49 EST 2008
Segher Boessenkool wrote:
> > Workaround gcc (4.1.1) problem with __weak 'empty' functions
>
> 4.1.x with x < 2
>
> > The compiler is optimizing weak functions that are empty.
>
> It considers for inlining all weak functions that are pure
> functions.
Actually, it has nothing to do with inlining. (Therefore, -fno-inline
etc. have no effect whatsoever on this problem!)
The compiler simply knows that a pure function has no side
effects, and hence is called only for using its result.
A call to a pure function where the result is unused can
therefore always be eliminated (no matter whether the
function is empty or not).
All this is in fact a completely valid optimization *if the
function that is called is actually the function that was
recognized as being pure*! This is not the case if
the function is marked weak; that this check was missing
is the bug.
B.t.w. the next release of ppu-gcc will contain a backport
of the fix for this problem.
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
--
Dr. Ulrich Weigand | Phone: +49-7031/16-3727
GNU compiler/toolchain for Linux on System z and Cell BE
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung:
Herbert Kircher
Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294
More information about the cbe-oss-dev
mailing list