When compiled with sdcc test.c, this results in test.c:3: error 9: FATAL Compiler Internal Error in file 'gen.c' line number '1805' : aopPut got unsupported aop->type. Tested on commit 11647.
That assignment to p stays there for mcs51 until the end (so codegen will try to copy the parameter into a function p), but for other ports, the iCode looks fine from dumpraw1 onwards.
P.P.S.: Apparently, for mcs51 only, OP_REQV (op) is 0 when that p is meant to be replaced in replaceRegEqvOperand in src/SDCCOpt.c.
P.P.P.S.: In geniCodeReceive in src/SDCCicode.c, we get into this if for mcs51 only:
The condition here looks like it will only be true for mcs51 only: hc08, s08 and mos6502 are explicitly excluded, ds390 always uses the flat24 model, pdk doesn't have register parameters, and the other ports have options.stackAuto == 1.
Last edit: Philipp Klaus Krause 2023-07-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A sentence in section 6.7.6.3 of the C2X standard (AFAIK, the same wording as in earlier standards): 'A declaration of a parameter as "function returning type" shall be adjusted to "pointer to function returning type", as in 6.3.2.1.'
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The bug still exists in current SDCC, for mcs51 only.
P.S.: This looks a bit weird. We have this in dumpraw0:
That assignment to p stays there for mcs51 until the end (so codegen will try to copy the parameter into a function p), but for other ports, the iCode looks fine from dumpraw1 onwards.
P.P.S.: Apparently, for mcs51 only,
OP_REQV (op)is 0 when that p is meant to be replaced inreplaceRegEqvOperandinsrc/SDCCOpt.c.P.P.P.S.: In
geniCodeReceiveinsrc/SDCCicode.c, we get into this if for mcs51 only:The condition here looks like it will only be true for mcs51 only: hc08, s08 and mos6502 are explicitly excluded, ds390 always uses the flat24 model, pdk doesn't have register parameters, and the other ports have
options.stackAuto == 1.Last edit: Philipp Klaus Krause 2023-07-29
I'm kinda surprised that this is valid C:
void f(int (p)(void))Doesn't
prequire a*before it here?A sentence in section 6.7.6.3 of the C2X standard (AFAIK, the same wording as in earlier standards): 'A declaration of a parameter as "function returning type" shall be adjusted to "pointer to function returning type", as in 6.3.2.1.'
[bugs:#3358] and this one are probably closely related.
Related
Bugs: #3358