This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inlining vs the stack
- From: Bernd Jendrissek <berndj at prism dot co dot za>
- To: Ian Lance Taylor <ian at airs dot com>
- Cc: Mike Stump <mrs at apple dot com>, Paul Koning <pkoning at equallogic dot com>,dalej at apple dot com, gcc at gcc dot gnu dot org, jh at suse dot cz
- Date: Sun, 14 Aug 2005 18:01:52 +0200
- Subject: Re: Inlining vs the stack
- References: <m3slxeg8js.fsf@gossamer.airs.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Fri, Aug 12, 2005 at 02:16:39PM -0700, Ian Lance Taylor wrote:
> Mike Stump <mrs@apple.com> writes:
> > X can be run time selectable, OMF selectable, OS defined...
>
> No.
>
> Making the stack bigger by inlining is no different from making it
> bigger by declaring and using more local variables or calls to alloca.
void killme(void)
{
int x[1000000000000000000]; /* Let's kill 64-bitters too. */
int i;
for (i = 0; i < sizeof (x) / sizeof (x[0]); i++) {
printf("%d\n", x[i]);
}
}
volatile int keep_going = 1;
void forever(void)
{
while (keep_going) {
/* Pretend this is a loop in FreeCiv. */
ai_move_units();
next_turn();
}
killme();
}
You'd expect the attempt to grow the stack to be made only *after*
keep_going hits zero. I'd rather not have the compiler presume
certainty of a 10GB stack allocation, especially not if it's actually
pretty unlikely.
- --
"If you lie to the compiler, it will get its revenge." - Henry Spencer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFC/2rj/FmLrNfLpjMRAioFAJ9M/i9LXiofpXBi0pPV1SU8yk6eJgCeL/Uo
noiQWoWPZXHHHQBrriG6kd4=
=Bmte
-----END PGP SIGNATURE-----