-
Notifications
You must be signed in to change notification settings - Fork 13.4k
morestack on x86 32-bit does not save edx nor floating point stack #7158
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Yeah, my best guess at the end of yesterday's adventure with auto-encode debugging was someone clobbering the register holding the high half of the v variable in a logging / io function. Calling any io function after loading v caused the failure. I'd believe stack switching / morestack is the culprit. |
This is currently manifesting on my system as |
Ah, I see that wikipedia states: "The x87 floating point registers ST0 to ST7 must be empty (popped or freed) when calling a new function, and ST1 to ST7 must be empty on exiting a function." We are definitely doing this wrong, but I'm not 100% sure of the correct X86 assembly to save the stack iff it is non-empty. |
I believe the correct thing to do is to use |
I should add: the code for doubles subtle enough that I would like a test that reproduces it. I have not been able to produce one, although I do have a test that uses the |
I think this is still relevant, @nikomatsakis? |
In today's meeting we have decided to jettison segmented stacks. Due to this no longer being used for switching stacks, I believe that this issue is moot. |
Right now, we return 64-bit values and doubles using the native convention, which is to use EDX:EAX and the floating stack respectively. morestack only saves/restores EAX, however. I've observed failures as a result, in particular the
src/test/run-pass/auto-encode.rs
test when executed with the default options (the failure goes away with RUST_MIN_STACK set to something appropriately high). Due to the unpredictable nature of stack switching, though, the failures tend to come and go.(cc @brson)
The text was updated successfully, but these errors were encountered: