This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: trampoline management in compound statements
- From: Ian Lance Taylor <iant at google dot com>
- To: "Neal H. Walfield" <neal at walfield dot org>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 25 Aug 2010 07:42:30 -0700
- Subject: Re: trampoline management in compound statements
- References: <8762yykfnm.wl%neal@walfield.org>
"Neal H. Walfield" <neal@walfield.org> writes:
> Can I rely on this behavior? In particular, can I rely on a
> trampoline staying valid until the enclosing function returns? Is the
> behavior of trampoline in a compound block specified somewhere?
That is a good question, and I agree that it would be good if taking the
address of a nested function within a compound expression produced a
result which is valid for the rest of the function. As you observed, it
currently does work that way. The compiler makes an effort to reuse
stack slots of local variables, but makes no such effort for the stack
space created for trampolines. However, there is no specification for
any of this.
I would recommend that you file a bug report with your test case and
explanation. The goal would be to include the test case in the gcc
testsuite and to update the docs to explicitly permit this use. That is
the best way to ensure that the current behaviour does not change in the
future. Thanks.
Ian