manuel123 0 Posted September 29, 2007 Report Share Posted September 29, 2007 Bug description: ------------------- The -swcs option does not work correctly together with function pointers. The call tree is not parsed correctly together with function pointers. With "-swcs 0 1" the following code compiles correctly. With"-swcs 2 1" the compiler uses the hardware stack for both, the call to __fptr and the calls of fptr0..4(). This results in a stack overflow during the call of fptr4(). Steps to reproduce: ----------------------- #include <system.h> void (*fptr0)(); void (*fptr1)(); void (*fptr2)(); void (*fptr3)(); void (*fptr4)(); void test4() { } void test3() { fptr4(); } void test2() { fptr3(); } void test1() { fptr2(); } void test0() { fptr1(); } void main() { fptr0 = test0; fptr1 = test1; fptr2 = test2; fptr3 = test3; fptr4 = test4; fptr0(); while(1); } Expected behaviour: The program should not produce a stack overflow. Is the problem 100% reproduceable: Yes. IDE version: 6.81 Compiler: BoostC, Compiler version: boostc.pic16.exe / v6.81 Target device: PIC16F88 OS: WinXP Comments: It seems that the call tree is not parsed through the __fptr function. If this is true, function pointers should be only compiled with "-swcs 0 1" or "-swcs 1 1" unless their use is very limited and the programmer takes care about stack overflows. BR manuel123 Quote Link to post Share on other sites
Dave 0 Posted November 23, 2007 Report Share Posted November 23, 2007 manuel123, Bug description:------------------- The -swcs option does not work correctly together with function pointers. The call tree is not parsed correctly together with function pointers. This has been fixed and will be in the next release. Regards Dave Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.