|
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
|
|