Skip to content
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

gccgo: nil panic when linking statically #6375

Closed
niemeyer opened this issue Sep 12, 2013 · 2 comments
Closed

gccgo: nil panic when linking statically #6375

niemeyer opened this issue Sep 12, 2013 · 2 comments

Comments

@niemeyer
Copy link
Contributor

Building the attached code from the Stack Overflow question http://goo.gl/QTpdHS fully
statically (-static), results in the following panic:

  panic: runtime error: invalid memory address or nil pointer dereference
  [signal 0xb code=0x1 addr=0x0]

  goroutine 2 [syscall]:

  goroutine 1 [runnable]:

Building it semi-statically (-static-libgo) works fine, though.

The crash looks like this in gdb:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00000000004adf67 in __wrap_pthread_create ()
#2  0x000000000040657e in runtime_newm ()
#3  0x000000000040665b in matchmg ()
#4  0x0000000000406f15 in syscall.Entersyscall ()
#5  0x0000000000403e5c in runtime_MHeap_Scavenger ()
#6  0x0000000000406e15 in kickoff ()
#7  0x00000000004ba910 in ?? ()
#8  0x0000000000000000 in ?? ()

Attachments:

  1. tictoc.go (529 bytes)
  2. main.go (212 bytes)
@niemeyer
Copy link
Contributor Author

Comment 1:

This was run with: gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)

@ianlancetaylor
Copy link
Contributor

Comment 2:

I can confirm that the bug happens in 4.7, but it does not happen in the current 4.8
sources.  I believe it was fixed by
http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=195244 .
It will work with 4.7 if you link with -Wl,-u,pthread_create .

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants