mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
![Keith Randall](/assets/img/avatar_default.png)
Normally this happens when combining a sign extension and a load. We want the resulting combo-instruction to get the line number of the load, not the line number of the sign extension. For each rule, compute where we should get its line number by finding a value on the match side that can fault. Use that line number for all the new values created on the right-hand side. Fixes #27201 Change-Id: I19b3c6f468fff1a3c0bfbce2d6581828557064a3 Reviewed-on: https://go-review.googlesource.com/c/156937 Reviewed-by: David Chase <drchase@google.com>
38 lines
681 B
Go
38 lines
681 B
Go
// run
|
|
|
|
// Copyright 2019 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 (
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
f(nil)
|
|
}
|
|
|
|
func f(p *int32) {
|
|
defer checkstack()
|
|
v := *p // panic should happen here, line 20
|
|
sink = int64(v) // not here, line 21
|
|
}
|
|
|
|
var sink int64
|
|
|
|
func checkstack() {
|
|
_ = recover()
|
|
var buf [1024]byte
|
|
n := runtime.Stack(buf[:], false)
|
|
s := string(buf[:n])
|
|
if strings.Contains(s, "issue27201.go:21 ") {
|
|
panic("panic at wrong location")
|
|
}
|
|
if !strings.Contains(s, "issue27201.go:20 ") {
|
|
panic("no panic at correct location")
|
|
}
|
|
}
|