[Ecls-list] Bug in code detecting stack growth direction
dherring at tentpost.com
Fri Feb 10 02:24:45 UTC 2012
On Fri, 3 Feb 2012, Juan Jose Garcia-Ripoll wrote:
> I just noticed that some cleverly optimizing compilers broke the code I used to detect whether the stack grows upwards or downwards. I will upload a patch tonight.
Wouldn't two calls to alloca() in a single function give a reliable answer
on pretty much all platforms?
printf("delta: %d\n", (int)(y-x));
The following was another idea; but it looks no better than what you have
void * start;
void * end;
void recurse(int n, void *y)
int main(int argc, char **argv)
printf("delta: %d\n", (int)(end-start));
This link indicates Sparc could violate some common assumptions about
stack behavior (though it looks to me like he was confusing the register
window with the stack).
More information about the ecl-devel