<pre class="notranslate">Current tip (13699:21130d62eeb0), linux/386, run enough times on a parallel machine:

$ GOARCH=386 GOMAXPROCS=32 go test std

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

goroutine 50 [running]:
testing.func·003(0xf7756fd4, 0xf7756100)
    /usr/local/google/home/dvyukov/go_vanilla/src/pkg/testing/testing.go:268 +0x123
----- stack segment boundary -----
runtime_test.TestStopTheWorldDeadlock(0x18855200, 0xe)
    /usr/local/google/home/dvyukov/go_vanilla/src/pkg/runtime/proc_test.go:25 +0x24
testing.tRunner(0x18855200, 0x82b3dd4, 0x0)
    /usr/local/google/home/dvyukov/go_vanilla/src/pkg/testing/testing.go:273 +0x71
created by testing.RunTests
    /usr/local/google/home/dvyukov/go_vanilla/src/pkg/testing/testing.go:349 +0x711

The culprit is:

// mgc0.c
static struct {
    uint64  full;  // lock-free list of full blocks
    uint64  empty; // lock-free list of empty blocks
...
} work;

8c does not align uint64 on 8-bytes, occasionally full/empty crosses cache-line boundary
and then

TEXT runtime·atomicload64(SB), 7, $0
    MOVL    4(SP), BX
    MOVL    8(SP), AX
    // MOVQ (%EAX), %MM0
    BYTE $0x0f; BYTE $0x6f; BYTE $0x00
    // MOVQ %MM0, 0(%EBX)
    BYTE $0x0f; BYTE $0x7f; BYTE $0x03
    // EMMS
    BYTE $0x0F; BYTE $0x77
    RET

becomes not particularly atomic.

There are 2 ways to fix it:
1. Fix the compilers to properly align uint64 (I am not sure why they do not align it
now).
2. Just patch the GC to manually align the vars.</pre>
<pre class="notranslate">[This may be a duplicate of <a href="https://golang.org/issue/770" rel="nofollow">issue #770</a>]

package main
import (
        "reflect"
        "fmt"
)
type X int
func (_ X) Foo() { }
func main() {
        v := reflect.NewValue(X(0))
        fmt.Printf("%d\n", v.Type().Method(0).Type.NumIn())
        fmt.Printf("%d\n", v.Method(0).Type().(*reflect.FuncType).NumIn())
        v.Method(0).Call([]reflect.Value{reflect.NewValue(X(0))})
}

this prints:
1
1
panic: FuncValue: wrong argument count

The type of the method should return the argument count
that the method is expected to be called with.

6g darwin 6d3022dfb42b+ tip</pre>