Closed feilipu closed 5 years ago
fcc just runs sdcc with options so if this is happening I would suspect sdcc.
If you run fcc with -V as well it will give you the SDCC commands it used. Could well be it's only triggering due to optimization settings and your exact compiler version.
The issue seems to be sdcc generating a bad .rel
, because sdasz80 picks up the problem.
If I compile with the options picked out of -V
from the Makefile
-S -o ceilf.asm
, there is no bad code in the resulting .asm
file,
EDIT. Totally not true. This generates bad code too.-c -o ceilf.rel
, it blows up when generating the .asm
.See below shell output.
phillip@SilverQuad:~/Z80/src/test_ceilf$ sdcc -V --std-c99 -mz80 --less-pedantic --max-allocs-per-node100000 --opt-code-size -D__FUZIX__ -Ddouble=float --fverbose-asm -DBUILD_LIBM -I/opt/fcc/include/ -c ceilf.c -o ceilf.rel
+ /usr/local/bin/sdcpp -nostdinc -Wall -std=c99 -D__FUZIX__ -Ddouble=float -DBUILD_LIBM -I/opt/fcc/include/ -obj-ext=.rel -D__SDCC_STACK_AUTO -D__SDCC_CHAR_UNSIGNED -D__SDCC_INT_LONG_REENT -D__SDCC_FLOAT_REENT -D__SDCC=3_9_1 -D__SDCC_VERSION_MAJOR=3 -D__SDCC_VERSION_MINOR=9 -D__SDCC_VERSION_PATCH=1 -D__SDCC_REVISION=11295 -D__SDCC_z80 -D__STDC_NO_COMPLEX__=1 -D__STDC_NO_THREADS__=1 -D__STDC_NO_ATOMICS__=1 -D__STDC_NO_VLA__=1 -D__STDC_ISO_10646__=201409L -D__STDC_UTF_16__=1 -D__STDC_UTF_32__=1 -isystem /usr/local/bin/../share/sdcc/include/z80 -isystem /usr/local/share/sdcc/include/z80 -isystem /usr/local/bin/../share/sdcc/include -isystem /usr/local/share/sdcc/include ceilf.c
+ /usr/local/bin/sdasz80 -plosgffw ceilf.rel ceilf.asm
ceilf.asm:193: Error: <a> machine specific addressing or addressing mode error
ceilf.asm:202: Error: <a> machine specific addressing or addressing mode error
ceilf.asm:312: Error: <a> machine specific addressing or addressing mode error
removing ceilf.rel
+ /usr/local/bin/sdasz80 -plosgffw ceilf.rel ceilf.asm returned errorcode 512
phillip@SilverQuad:~/Z80/src/test_ceilf$
EDIT - Bug report #2918 raised on SDCC.
I'm compiling using clean repo using
z80pack
target, and I find that compilingceilf.c
is causing undocumented assembly using theiyh
register.When I do the same with
ceilf.c
with sdcc standalone. i.e with following command line, it doesn't generate the same issue. That, I find really strange.Both results attached.
~FUZIX-Library-libs-ceilf.asm
~ceilf.asm
Normally, this wouldn't be a problem, but I'm trying to compile this for a z180 so this isn't going to work at all. For reference changing the
USERCPU
references toCPU
in the make files causes the compiler to issue-mz180
, but this still doesn't prevent undocumented instructions appearing.There's something afoot, because I didn't just find this bad assembly, it causes an error and causes the compile to bomb too.
Thoughts? What am I doing wrong?