The attached program compiles fine in model small, but fails to compile in model large for MCS51.
sdcc-sdcc --model-small -c y.c
OK
sdcc-sdcc --model-large -c y.c
y.c:20: error 16: variable 'd' must be static to have storage class in reentrant function
$ sdcc-sdcc -v
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.6.0 #9615 (Linux)
published under GNU General Public License (GPL)
y.c compiles without error and the resulting assembly looks correct for version 3.7.1 #10421. You should probably update the version you are using; 3.6.0 #9615 was released just over 2 years ago.
Thanks Erik. I'm using 3.6.0, because that's what is included in the latest Fedora and that's what the latest Windows installer binaries are (apart from the snapshots)
Version 3.7.0 #10231 works too. Now the question is how do I build a windows installer for 3.7.0 ...
3.7.0 was a source-only release, since we had problems with our compile farm (or problems with new requirements that new SDCC versions put on the infrastructure in the compile farm). We hope to be able to do a 3.8.0 release later this summer (AFAIK, from the compile-farm side only x86-64 macOS snapshot builds are missing now).
Philipp
Closing this issue, since it has been confirmed that is it works in current SDCC.
Philipp