site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Mar 3, 2009, at 2:00 PM, Brian Mastenbrook wrote: On Mar 3, 2009, at 3:35 PM, Ryan McGann wrote: void foo(int flag) { if (flag) { largeStackUsingFunction(); } else { char buf[1000]; /* ... other code which does not call functions ... */ } } Thanks to all for the help. Ryan _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... We have some sample code that shows that the temporary returned from the function doMath is allocated stack space twice, when it can only be used once. But since the function in our actual production code is pretty complex, it's hard to know hwich problem we are experiencing. However, the above examples are both well documented cases of GCC problems; I actually got the basic ideas for both examples from Linus Torvald's (sometimes long) emails regarding Linux's problems with GCC stack allocation. I've been bitten by this problem in the past as well, especially in functions that look a lot like the examples you've given (where an outer if wraps several complex code blocks). The worst of it is that in this example: Just to let everybody know, I got the library to compile with the Intel icc compiler. It produced a stack in debug builds (-O0) that is 116 bytes, and in release builds (-O3) is 92 bytes. Obviously this is perfect for our x86/x86_64 builds. Our PowerPC customers are unfortunately hosed, as the IBM compiler does not look like it will work in the time that I have to finish this project. For PowerPC we will unfortunately lose some major features, but at least it won't panic. This email sent to site_archiver@lists.apple.com
participants (1)
-
Ryan McGann