Calling a function decorated with both inline and __reentrant causes bad code generation on MCS51. In the example below, SDCC inserts two rogue inc sp instructions. When I remove __reentrant, the code looks correct
Command to compile:
sdcc-sdcc -c x.c
$ 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)
This bug also affects ds390 (but not other backends, in particular it does not affect hc08 despite that one otherwise being similar inhandling of reentrancy).
In [r10413], I added a test (currently disabled for mcs51 and ds390).
Increasing priority, since bad code is generated silently.
Philipp
This bug also affects ds390 (but not other backends, in particular it does not affect hc08).
In [r10413], I added a test (currently disabled for mcs51 and ds390).
Increasing priority, since bad code is generated silently.
Philipp
P.S.: However, hc08 also does an apparently unnecessary stack adjustment by 2, it hust readjusts the stack accordingly at function exit, so it only wastes stack space, but does not jump into the void.
Fixed in [r10420]
Diff: