Re: Relocation errors with g++-3.2
Kelledin <kelledin+DAXP@skarpsey.dyndns.org> writes:
> On Saturday 05 April 2003 08:54 pm, Falk Hueffner wrote:
> > As a workaround, try to find out which switch statement causes
> > it and don't inline the function (a function complex enough to
> > contain a switch statement probably shouldn't be inline,
> > anyway).
>
> Well...I poked around in the case where this applies to me
> (kdegames-3.1.1, specifically kmines). Apparently this scenario
> never occurs; the only explicitly inlined functions I see are in
> grid2.h, and not one contains a switch statement. Have I possibly
> missed something?
>
> I tried building with -fno-default-inline (to counteract class
> methods getting automatically inlined). No joy...
It's in grid2.h:
static Coord neighbour(const Coord &c, Neighbour n) {
switch (n) {
case Left: return c + Coord(-1, 0);
case Right: return c + Coord( 1, 0);
case Up: return c + Coord( 0, -1);
case Down: return c + Coord( 0, 1);
case LeftUp: return c + Coord(-1, -1);
case LeftDown: return c + Coord(-1, 1);
case RightUp: return c + Coord( 1, -1);
case RightDown: return c + Coord( 1, 1);
}
return c;
}
As a fix, either uninline this, or use a non-moronic design that will
not lead to code bloat and unpredictable indirect branches in critical
paths.
--
Falk
Reply to: