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
You initialize the Fiber. At the end of the constructor, ctx.env[0] points to zero-allocated memory. Then you call call(). The registers are captured in env and the state from ctx is loaded. Next is the call to run(). Because it is a virtual function, this is needed to load the pointer to the vtable. this is stored on the stack - which is zero at this time. Bang!
It works with -O1 because the this pointer is stored in rbx which you saved in ctx.
It works with -g because in this case a stack frame is constructed with rbp. You save this register, too.
Development Environment: Arch Linux(kernel 4.1) 64bit with ldc 0.15.1
This is my test code:
md.S
coro.d:
The executable file compiled by dmd or ldc -g/-O can work properly, but with ldc, it will throw segmentfault.
And I have used objdump -d to get the assembly code of exe file, and I found the problem may be inside the following area:
%rax = 0, how is it come?
The text was updated successfully, but these errors were encountered: