Skip to content

runtime/race: Go 1.2 race detector and map of pointers => nil defererence, segfault #7766

@gopherbot

Description

@gopherbot

by andres.erbsen:

This bug does not appear (at least with the same test code) on the development version
(go version devel +93ad232384f8 Fri Apr 11 10:11:21 2014 -0700 linux/amd64) and may
therefore be already fixed.

The combination of go 1.2, the race detector, a map of pointers and a function returning
two values somehow results in a nil dereference on linux/x86_64.

What does 'go version' print?
go version go1.2.1 linux/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. Compile http://play.golang.org/p/0fIDCUE2m2c with "-race"
2. Run it

What happened?

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

goroutine 1 [running]:
runtime.panic(0x438400, 0x4aea68)
    /build/go/src/go-1.2.1/src/pkg/runtime/panic.c:266 +0xb6
main.main()
    main.go:10 +0x52

What should have happened instead?

no output

Either uncommenting the seemingly nop read from the map or compiling without
"-race" makes the segfault not happen.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions