kervinck / gigatron-rom

System, apps and tooling for the Gigatron TTL microcomputer
BSD 2-Clause "Simplified" License
229 stars 81 forks source link

lcc: compiler hangs on simple statement #77

Open kervinck opened 5 years ago

kervinck commented 5 years ago
$ cat hang2.c
int f(int c)
{ 
  if (c == -1)
    return 0;
}
$ make hang2.gt1
Utils/lcc/build/lcc -ILibs -c hang2.c -o hang2.o
hang2.c:5: warning: missing return value
Assertion failed: (offset < 0x10000lu), function local, file ./build/gt1.c, line 4435.
Utils/lcc/build/lcc: fatal error in Utils/lcc/build/rcc
make: *** [hang2.o] Error 1
$

Similar to #76 but not the same.

kervinck commented 5 years ago

This is in fact the same type of register spilling issue as #76. We can solve it with #76, or workaround it by replacing SUBW with XORW for the relational operator (this could be part of #64).

lb3361 commented 1 year ago

This issue should be closed since glcc fixes it.