-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
gopack: segmentation fault in runtime #48
Labels
Comments
Issue #57 has been merged into this issue. |
Owner changed to [email protected]. |
gopack.strace for merged isssue 57 Attachments:
|
This issue was closed by revision a174987. Status changed to Fixed. Merged into issue #-. |
It does not fix the segfault under native arm build (originally raised in issue #57). |
$ hg log -l 1 changeset: 3992:14daa3d2c998 tag: tip user: Russ Cox <[email protected]> date: Wed Nov 11 14:51:53 2009 -0800 summary: point at how to get easy_install on Ubuntu. Attachments:
|
bt output Attachments:
|
ninkendo: did the fix solve your gopack problem? (You'll have to hg pull -u to get an updated tree.) b88zhou: I have been through the relevant code again and cannot see how that trace can happen. It looks like in duplicate, p->name is 0, which should not be possible. If you have experience with C and want to try to figure it out, it's a very simple hash table somehow gone awry. Status changed to Accepted. |
$ cat hashstr.c #include <stdio.h> int hashstr(char *name) { int h; char *cp; h = 0; for (cp = name; *cp; h += *cp++) h *= 1119; printf("before h=%d\n", h); if (h < 0) h = ~h; printf("after h=%d\n", h); return h; } int main(void) { int n, h; n = hashstr("breakpoint"); h = n % 1024; printf("hashstr=%d h=%d\n", n, h); } $ gcc-4.3 -g -o hashstr hashstr.c $ ./hashstr before h=-585750607 after h=585750606 hashstr=585750606 h=78 $ gcc-4.3 -g -O2 -fno-inline -o hashstr hashstr.c $ ./hashstr before h=-585750607 after h=-585750607 hashstr=-585750607 h=-79 $ gcc-4.4 -g -o hashstr hashstr.c $ ./hashstr before h=-585750607 after h=585750606 hashstr=585750606 h=78 Looks like a gcc 4.3 specific bug when using -O2. Reproducible on two NAS devices. |
Tried your suggestion, does not work. My guess is that gcc 4.3 -O2 optimized away (h < 0) as always false. The following seems to work: int hashstr(char *name) { unsigned int h; char *cp; h = 0; for (cp = name; *cp; h += *cp++) h *= 1119; if (h & (0x01 << 31)) h = ~h; return (int) h; } During native build, gopak no longer segfaults. I had a different problem now, I'll file a separate issue. Thanks. |
Fixed by http://golang.org/cl/152088 Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by ninkendo:
Attachments:
The text was updated successfully, but these errors were encountered: