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
hashable 1.2.0.x segfaults with ByteString on 32bit Linux, GHC 7.0.4 #52
Comments
The master branch still causes segfault. I'm using GHC 7.0.4 on a 32bit Linux machine. This bug exists in compiled code, too. Actually, I found this bug as (complied) Mighty caused segfault when it received an HTTP request. |
Both hashable 1.2.0.4 and the current master (33a7234) do not solve this problem. |
The following code caues this segfalt:
|
Since I could not found a way to make use of SSE2 on 32bit Linux, I just made a workaround for the 8byte alignment problem:
Both on 64bit Linux and 32bit Linux, cabal tests are passed. On 32bit Linux, (hash "/") results in -1811599090. |
Note that I have not tested this on Windows. |
@kazu-yamamoto I cannot reproduce your crash with the original test case on 32-bit Linux or Windows. Also, it's expected that hashing gives different results on 32-bit and 64-bit systems, since Ints (and hence the default salt) are different sizes. |
I installed GHC 7.4.2 for this 32bit Linux today. It does not cause this problem. So, this problem is caused by combination of GHC 7.0.4 and 32bit Linux. (GHC 7.0.4 on 64bit Linux does not cause this problem.) |
Thanks, @kazu-yamamoto, that was the extra information I needed. |
My 32bit Linux (Linux 2.6.18) does not have le64toh in endian.h. Compiling hashable displays the following warning:
And GHC cannot compile my test program:
|
Your userland on that machine is 4 or more years old - |
FreeBSD does not have endian.h but has sys/endian.h including le64toh. To bury differences, may I introduce "configure"? |
I sent a pull request to solve this problem without using configure. What do you think? |
Very similar to 1360f47, which I was writing at the same time. |
I confirmed that the current master works well on:
Thank you very much. |
On 32bit Linux, hashing ByteString causes segfault:
% ghci -XOverloadedStrings
This bug introduced some between 1.1.2.5 and 1.2.0.0. This bug does not exist on 64bit Linux.
The text was updated successfully, but these errors were encountered: