The stm8 assembler does not correctly assemble subw as of revision #8880. E.g. from .lst files:
000016 72 BBu00u00 [ 2] 94 addw x, _i+0
vs.
000025 72 B0u00 [ 2] 115 subw x, _i+0
We can see that the subw only gets one address byte instead of two.
This rpevents using subw with global variables. Once this bug is fixed, generation of subw can be anabled in lines 2266, 2302 and 2343 of gen.c.
Philipp
It is fixed.
The 2 files are compressed into the attachment.
And also a patch is submitted,
https://sourceforge.net/p/sdcc/patches/215/
Fixed in revision #8393 by applying your patch.
Philipp