mburkley / tms9900-gcc

gcc cross-compiler for TMS9900
GNU General Public License v3.0
13 stars 1 forks source link

[bug][OK in branch 1.32] 28 - 0 = 27 with a minimal example with source code and EA5 binary #62

Closed Fabrizio-Caruso closed 1 week ago

Fabrizio-Caruso commented 4 weeks ago

I can provide a minimal example (source code, map file and binary attached) that produces a wrong result for a simple operation: 28 - 0 = 27

I may try to further simplify it.

It was build with:

tms9900-gcc -c projects/ti99testb/main.c -o projects/ti99testb/main.o
tms9900-ld ../tools/ti99/crt0_ea5.o projects/ti99testb/main.o  -std=c99 -O2  -s -I./ -fno-builtin -fno-peephole2 -fno-function-cse  -nostdlib  --section-start .text=a000 --section-start .data=2080 -M -L/opt/gcc4ti/lib -lti99 -o xchase.ea5.elf > xchase.map
../tools/ti99/elf2ea5.exe xchase.ea5.elf xti99testb1.ea5.bin
../tools/ti99/ea5split.exe xti99testb1.ea5.bin

main.zip

xchase.zip

XTI99TESTB1.zip

The correct bottom value should be 28 (you can build the same code natively with gcc to see the correct result) image

mburkley commented 1 week ago

Problem caused because subtracting a register from a constant was broken in insn rsubihi - fixed in 1.32