Compiling the example below with '--stack-auto' will fail in the function 'func_0_ng'.
error 9: FATAL Compiler Internal Error in file '../../../sdcc_svn/sdcc/src/mcs51/gen.c' line number '478' : getFreePtr should never reach here
'func'0_ok' is a workaround that I'm using for now.
My SDCC version is 4.1.6 #12575 (with some local seemingly unrelated modifications).
#include <stdint.h>
extern uint8_t func_2 (void);
extern void func_1 (void) __banked;
__xdata uint32_t g_x = 0;
#if 1
void func_0_ng (uint64_t x) __banked
{
if (func_2 ())
{
if (g_x == 0)
g_x = (uint32_t)x | 1;
if ((uint32_t)x - g_x > 10)
func_1 ();
}
}
#endif
#if 1
void func_0_ok (uint64_t x_) __banked
{
uint32_t x = x_;
if (func_2 ())
{
if (g_x == 0)
g_x = (uint32_t)x | 1;
if ((uint32_t)x - g_x > 10)
func_1 ();
}
}
#endif
A slightly reduced case:
Issue still present as of SVN r14412.
@spth I guess this will evaporate with the new register alloactor?
I've tried this again on svn r16432.
The "slightly reduced case" above doesn't fail anymore. But the case in the original description still fails.