-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
64-bit: Returning a multi-field structure by value does not work #65
Comments
That source code works for me with both llvm-gcc and clang with various emscripten settings. Can you paste the generated .ll and .js files? |
Here is the .ll file: http://pastebin.com/gtfAshzZ |
Looks like that is compiled as 64-bit? (target triple = "x86_64-unknown-linux-gnu" and many appearances of i64) Emscripten doesn't support 64-bit code well, because it is a poor fit for JavaScript (JS integers are 32-bit, and while floats are 64-bit, the actual integers they can contain are only up to 53 bits or so). Compiling the source with -m32 should make it work properly (you may need to install some 32-bit headers on your system). Long-term, the solution for emscripten is to bundle our own headers and build only against them. We have an issue open for that. |
Thanks for the tip, it does work fine. I changed the issue to reflect that it only affects 64-bit compliation. |
I added a FAQ entry for this. Marking as closed since I don't think there is a way to properly fix this. 32-bit compilation is the way to go for now. |
When returning a structure from a function, only the first element is returned.
This program prints "5 0" instead of "5 6". If adding a third field to the structure, d8 dies with the following error:
(llvm v2.9, v8 3.2.10.2, emscripten cca5278)
-- edit:
This only affects 64-bit compilation. Please compile with -m32 until 64-bit is properly supported.
The text was updated successfully, but these errors were encountered: