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
cmd/6c: miscompiles valid C code. #8454
Labels
Comments
http://stackoverflow.com/questions/25048775/am-i-doing-something-wrong-or-is-this-a-bug-in-gos-c-compiler/25049681#25049681 Changing the C function signature to `void ·XXH32_test(const unsigned char* input, U32 len, U32 seed, U32 *ret)` and assigning the hash to *ret seems to return the right value. I still think this is a bug. |
Yes, 6a will remain. And it will be written in Go too. The ultimate goal for 6a is that it will be based on latest intel manuals, so it will support all the latest instructions. Anyway, for xxHash, I suggest you'd better write it in Go. The first reason is that the Plan 9 C Compiler will go away eventually, and 2nd is that 6g will become better over time, but we definitely won't spend time to improve 6c. |
R3 #2, 6c and 6g are using different function call ABI in that go can't read return value from C functions. This is not a bug (C doesn't support multiple return values.) you need to do this: #define FLUSH(x) USED(x) void ·XXH32_test(const unsigned char* input, U32 len, U32 seed, U32 ret) { // calculate ret ret = 42; FLUSH(&ret); } but still, use pure Go is much better. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: