Open Cr0a3 opened 2 weeks ago
Is open for reopen
Wasn't fixed i knew it
Debugging is a bit hard because https://github.com/gimli-rs/object/issues/721
Fixed.
After some long debugging sessions i found out why. It's because the variables which are in the registers for the function arguments get overriten and then read for the new argument. They are also not saved because they aren't used after the call.
Example assembly line:
mov rcx, r10 // r10 = adress of string
mov rdx, rcx // rcx was the variable which is now overriden by the arg
mov r8, rsi
mov r9d, r11d
push rdi
call printf
Yeah, so i need to fix that. Maybe by using the stack?
Why did github close the issue??
So i found out the generated assembly code is now correct but the instruction encoding has some errors again!
Describe the bug Running a simple example from simplelang:
Outputs:
What it shouldn't. Here's the expected output:
The
1827627024
is the adress of the formatting string (%d = %d
) which means that the register of the variablex
gets overrideden.IR
In line:
%3 = i64 %2
the compile thinks that%2
is dropped which means it frees the resources. But sussly the resources from the last free aren't assignet back so the register for the variable gets overriden by the next line:%4 = ptr .const1
Generated assembly