Hi all,
I am working on building kertex for windows, and I believe I found a bug
with TinyCC.
fixed i hope
<https://github.com/Thewafflication/kertex_package/actions/runs/30430108664/
job/90505462956#step:9:152> . Thewafflication/kertex_package@f099814
* TinyCC: 0.9.28rc
* Commit: d9d02c56401e
* Target: AArch64 Windows
* Host: GitHub windows-11-arm
Minimal reproducing code:
typedef unsigned long long u64;
static unsigned short data[844];
static u64 address_for_index(int index)
{
return (u64)(void *)data - 845186ULL + (u64)index * 2;
}
int main(void)
{
return address_for_index(422593) != (u64)(void *)data;
}
Expected exit code: 0
TinyCC ARM64 exit code: 1
The decisive generated instructions are:
mov w0, #-0x1000000
add x1, x1, x0
Writing w0 zero-extends into x0, so the add uses 0x00000000ff000000 instead
of 0xffffffffff000000. The result is exactly 0x100000000 too high.
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel