This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: trampoline management in compound statements


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]