Current FUZIX doesnÄt compile with current SDCC: taylormade.c compiles to invalid .asm. There is invalid asm in 6 places. I checked the first 4, and all are places where peephole rule 77b got applied.
To reproduce: Check out current FUZIX and build it.
Here is a small code sample, that, compiled with sdcc -mz80 test.c reproduces the issue.
77b cannot break anything. It just removes redundand zero after absolute value:
I think the problem happens when %2 is already an expression with parentheses around it.
Maybe the assembler doesn't like double parentheses around an expression, so it would accept e.g. (#(x + 1) + 0), but not (#(x + 1)).
I think, it is bug of assembler itself. The rule can be temporary commented out.
I guess the assembler interprets the extra parentheses as an indirection.
In [r11836] I disabled the peephole rule for now.
Why have you disabled rule 44? 77b and 77c should be disabled only.
Peephole 44 breaks the same code.
The assembler accepts
but not
Since the outer parentheses make this a load from memory, not from an immediate. The Z80 has ld a, (nn), but not ld h, (nn).
Maybe rule 44 just needs a canAssign condition?
Yes. canAssign is required here.
I have reenabled rule 44 after adding canAssign: [r11839].
Last edit: Sergey Belyashov 2020-08-27