Compiling current FatFs R0.13b with current SDCC 3.7.1 #10498 fails when FF_USE_MKFS is defined.
I tracked the issue down to the funktion f_mkfs. The attached file contains a simplified version of ff.c, which reproduces the bug (but still needs the headers from FatFs).
Diff:
Diff:
Diff:
Diff:
This fails for z80, too (but apaprently not mcs51 or hc08).
Philipp
Actually, for mcs51 with --stack auto, there is no assertion failure at compile time, but wrong code is generated silenty.
Apparently, the iCode at register allocation is already wrong (looking at --dump-ralloc output). It pushes an unsigned long paramter, where the mem_set() expects an unsigned int. So we push 2 more bytes of parameters than we readjust the stack after the call for.
Philipp
dumpraw1 is still correct, dumpcse is already wrong, so this is probably a bug in CSE.
Philipp
dumpraw1 is correct, dumpcse is alredy wrong, so this is a bug in CSE.
Philipp
In [r10500], I added a (disabled by #if 0 until the bug is fixed) regression test for this bug.
Philipp
Fixed in [r11130]