While working on struct parameters I ran into a preexisting stm8 codegen bug:
When a function return its value via a hidden pointer parameter (i.e. it return long long, struct, union or a _BitInt(N) with N > 8), rematerialization of on stack-addresses doesn't take into account the 2 byte offset from the hidden parameter.
Fixed in [r13262].
Related
Commit: [r13262]