------- Comment #6 from falk at debian dot org 2006-02-20 23:06 ------- (In reply to comment #5)
> If this is really not feasible or will not work in any useful cases, > maybe exposing the stack to the user would be a nice thing to have. > Like > > foo() > { > int *p = __builtin_stack_top(); > *(p--) = i; > ... > } > > where __builtin_stack_top() would be beyond the known stack usage of > foo(), erroring in case of function calls, of course (or even make > the stack decrements builtins). This would be a quite finicky interface. For example, on the Alpha architecture, the stack pointer needs to be 16-byte aligned at all times. Also, you must not read at some position on the stack unless you've previously written within 4096 bytes (or something) of that position. I suppose other architectures have similar peculiarities. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26388