You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The segfault happens because rdx is 0. Curiosly, rcx is 3 in this example, and is set to the value of a. However for both rcx and rdx the __muloti4 function is expecting these to be pointers to a and b respectively, so this is an ABI mismatch. On the _muloti4 side of things this seems to be correct, however at the callsite, which is how LLVM lowers a * b for 128 bit integers, it does not seem to match.
I'm looking at the LLVM code for how they lower 128 bit multiplication on Windows to find out what's going on.
I think what's going on here is that LLVM actually doesn't support 128-bit integer multiplication on Windows. That's one of the reasons that Zig has a port of compiler-rt and not actually a build of C compiler-rt from source, because we want to make it available. That being the case, Clang/LLVM has not actually fixed their ABI issue with __muloti4 and 128 bit integer multiplication, so it's up to Zig to put a workaround in.
This results in a segfault. Here's what's happening. This invokes
__muloti4
from compiler-rt:Inside the
__muloti4
call:The segfault happens because
rdx
is 0. Curiosly,rcx
is3
in this example, and is set to the value ofa
. However for bothrcx
andrdx
the__muloti4
function is expecting these to be pointers toa
andb
respectively, so this is an ABI mismatch. On the_muloti4
side of things this seems to be correct, however at the callsite, which is how LLVM lowersa * b
for 128 bit integers, it does not seem to match.I'm looking at the LLVM code for how they lower 128 bit multiplication on Windows to find out what's going on.
This is the issue blocking #2102.
The text was updated successfully, but these errors were encountered: