Skip to content

Commit 2377c68

Browse files
committed
fix pushing 32 bit variable values
1 parent 758c41f commit 2377c68

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

source/backends/x86_64.d

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ class BackendX86_64 : CompilerBackend {
554554
break;
555555
}
556556
case 4: {
557-
output ~= format("mov%cxd rax, $(DWORD) [rbx + %d]\n", op, offset);
557+
output ~= "xor rax, rax\n";
558+
output ~= format("mov eax, [rbx + %d]\n", offset);
558559
break;
559560
}
560561
case 8: output ~= format("mov rax, [rbx + %d]\n", offset); break;
@@ -572,7 +573,8 @@ class BackendX86_64 : CompilerBackend {
572573
break;
573574
}
574575
case 4: {
575-
output ~= format("mov%cxd rax, dword [%s + %d]\n", op, symbol, offset);
576+
output ~= "xor rax, rax\n";
577+
output ~= format("mov eax, [%s + %d]\n", symbol, offset);
576578
break;
577579
}
578580
case 8: output ~= format("mov rax, [%s + %d]\n", symbol, offset); break;

0 commit comments

Comments
 (0)