mirror of
https://github.com/golang/go
synced 2024-11-25 16:57:58 -07:00
cmd/5l, cmd/6l, cmd/8l: fix segfault on reading LOCALS for a duplicate definition.
Fixes #5105. R=golang-dev, dave, daniel.morsing, rsc CC=golang-dev https://golang.org/cl/7965043
This commit is contained in:
parent
60a1f54d6b
commit
d815a14718
@ -608,11 +608,15 @@ loop:
|
||||
break;
|
||||
|
||||
case ALOCALS:
|
||||
if(skip)
|
||||
goto casedef;
|
||||
cursym->locals = p->to.offset;
|
||||
pc++;
|
||||
break;
|
||||
|
||||
case ATYPE:
|
||||
if(skip)
|
||||
goto casedef;
|
||||
pc++;
|
||||
goto loop;
|
||||
|
||||
|
@ -597,11 +597,15 @@ loop:
|
||||
goto loop;
|
||||
|
||||
case ALOCALS:
|
||||
if(skip)
|
||||
goto casdef;
|
||||
cursym->locals = p->to.offset;
|
||||
pc++;
|
||||
goto loop;
|
||||
|
||||
case ATYPE:
|
||||
if(skip)
|
||||
goto casdef;
|
||||
pc++;
|
||||
goto loop;
|
||||
|
||||
|
@ -607,11 +607,15 @@ loop:
|
||||
goto loop;
|
||||
|
||||
case ALOCALS:
|
||||
if(skip)
|
||||
goto casdef;
|
||||
cursym->locals = p->to.offset;
|
||||
pc++;
|
||||
goto loop;
|
||||
|
||||
case ATYPE:
|
||||
if(skip)
|
||||
goto casdef;
|
||||
pc++;
|
||||
goto loop;
|
||||
|
||||
|
7
test/fixedbugs/issue5105.dir/a.go
Normal file
7
test/fixedbugs/issue5105.dir/a.go
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package a
|
||||
|
||||
var A = [2]string{"hello", "world"}
|
15
test/fixedbugs/issue5105.dir/b.go
Normal file
15
test/fixedbugs/issue5105.dir/b.go
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import "./a"
|
||||
|
||||
var B = [2]string{"world", "hello"}
|
||||
|
||||
func main() {
|
||||
if a.A[0] != B[1] {
|
||||
panic("bad hello")
|
||||
}
|
||||
}
|
10
test/fixedbugs/issue5105.go
Normal file
10
test/fixedbugs/issue5105.go
Normal file
@ -0,0 +1,10 @@
|
||||
// rundir
|
||||
|
||||
// Copyright 2013 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Issue 5105: linker segfaults on duplicate definition
|
||||
// of a type..hash.* function.
|
||||
|
||||
package ignored
|
Loading…
Reference in New Issue
Block a user