aboutsummaryrefslogtreecommitdiff
path: root/test/nilptr.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2013-04-24 08:13:01 -0700
committerIan Lance Taylor <iant@golang.org>2013-04-24 08:13:01 -0700
commit578dc3a96ce6649b021ee437e089af3a205dff82 (patch)
tree3a92765d020d963f48dd6a22a89176a6308f74b3 /test/nilptr.go
parent73417e4098f59b3b03e7b3287427be6e47d9f56e (diff)
downloadgo-578dc3a96ce6649b021ee437e089af3a205dff82.tar.gz
go-578dc3a96ce6649b021ee437e089af3a205dff82.zip
cmd/5g, cmd/6g, cmd/8g: more nil ptr to large struct checks
R=r, ken, khr, daniel.morsing CC=dsymonds, golang-dev, rickyz https://golang.org/cl/8925043
Diffstat (limited to 'test/nilptr.go')
-rw-r--r--test/nilptr.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/nilptr.go b/test/nilptr.go
index b784914e59..793e996736 100644
--- a/test/nilptr.go
+++ b/test/nilptr.go
@@ -38,6 +38,8 @@ func main() {
shouldPanic(p8)
shouldPanic(p9)
shouldPanic(p10)
+ shouldPanic(p11)
+ shouldPanic(p12)
}
func shouldPanic(f func()) {
@@ -130,3 +132,23 @@ func p10() {
var t *T
println(t.i) // should crash
}
+
+type T1 struct {
+ T
+}
+
+type T2 struct {
+ *T1
+}
+
+func p11() {
+ t := &T2{}
+ p := &t.i
+ println(*p)
+}
+
+// ADDR(DOT(IND(p))) needs a check also
+func p12() {
+ var p *T = nil
+ println(*(&((*p).i)))
+}