1
0
mirror of https://github.com/golang/go synced 2024-11-25 19:27:56 -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:
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; break;
case ALOCALS: case ALOCALS:
if(skip)
goto casedef;
cursym->locals = p->to.offset; cursym->locals = p->to.offset;
pc++; pc++;
break; break;
case ATYPE: case ATYPE:
if(skip)
goto casedef;
pc++; pc++;
goto loop; goto loop;

View File

@ -597,11 +597,15 @@ loop:
goto loop; goto loop;
case ALOCALS: case ALOCALS:
if(skip)
goto casdef;
cursym->locals = p->to.offset; cursym->locals = p->to.offset;
pc++; pc++;
goto loop; goto loop;
case ATYPE: case ATYPE:
if(skip)
goto casdef;
pc++; pc++;
goto loop; goto loop;

View File

@ -607,11 +607,15 @@ loop:
goto loop; goto loop;
case ALOCALS: case ALOCALS:
if(skip)
goto casdef;
cursym->locals = p->to.offset; cursym->locals = p->to.offset;
pc++; pc++;
goto loop; goto loop;
case ATYPE: case ATYPE:
if(skip)
goto casdef;
pc++; pc++;
goto loop; 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