compiler crash when returning structs larger than 8 bytes with:
error 9: FATAL Compiler Internal Error in file 'gen.c' line number '2015' : code generator internal error
sdcc -mmos6502 test.c
typedef struct {
char a[9];
} s;
s func()
{
s ret;
ret.a[0]=1;
return(ret);
}
both mos6502 and s08 port fail in similar ways.
Hmm. The hc08_aop_pass mechanism used for hc08 and s08 doesn't really allow for more than 8 bytes.
Maybe switch to return via hidden parameter for larger values, like pdk does (pdk already does it for return values larger than 2 bytes)?
Last edit: Philipp Klaus Krause 2022-03-16
A while ago (in the next branch, since merged to trunk), I made this a proper error message instead of a compiler crash. Making it work is [feature-requests:#879].
Related
Feature Requests: #879
Last edit: Philipp Klaus Krause 2023-07-28