Commit d815a147 authored by Rémy Oudompheng's avatar Rémy Oudompheng

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
parent 60a1f54d
...@@ -608,11 +608,15 @@ loop: ...@@ -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;
......
...@@ -597,11 +597,15 @@ loop: ...@@ -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;
......
...@@ -607,11 +607,15 @@ loop: ...@@ -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;
......
// 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"}
// 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")
}
}
// 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment