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:
Rémy Oudompheng 2013-03-25 22:09:55 +01:00
parent 60a1f54d6b
commit d815a14718
6 changed files with 44 additions and 0 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View 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"}

View 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")
}
}

View 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