Update to copy of current master Go testsuite.
[official-gcc.git] / gcc / testsuite / go.test / test / fixedbugs / issue5963.go
blob190e8f4564748513ae42e3b21ec2dde54db3eb17
1 // run
3 // Copyright 2013 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Used to die in runtime due to init goroutine exiting while
8 // locked to main thread.
10 package main
12 import (
13 "os"
14 "runtime"
17 func init() {
18 c := make(chan int, 1)
19 defer func() {
20 c <- 0
21 }()
22 go func() {
23 os.Exit(<-c)
24 }()
25 runtime.Goexit()
28 func main() {
31 /* Before fix:
33 invalid m->locked = 2
34 fatal error: internal lockOSThread error
36 goroutine 2 [runnable]:
37 runtime.MHeap_Scavenger()
38 /Users/rsc/g/go/src/pkg/runtime/mheap.c:438
39 runtime.goexit()
40 /Users/rsc/g/go/src/pkg/runtime/proc.c:1313
41 created by runtime.main
42 /Users/rsc/g/go/src/pkg/runtime/proc.c:165
44 goroutine 3 [runnable]:
45 main.funcĀ·002()
46 /Users/rsc/g/go/test/fixedbugs/issue5963.go:22
47 created by main.initĀ·1
48 /Users/rsc/g/go/test/fixedbugs/issue5963.go:24 +0xb9
49 exit status 2