Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(772)

Unified Diff: test/nilptr.go

Issue 8925043: code review 8925043: cmd/5g, cmd/6g, cmd/8g: more nil ptr to large struct checks (Closed)
Patch Set: diff -r e729bb70416a https://code.google.com/p/go Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/8g/cgen.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/nilptr.go
===================================================================
--- a/test/nilptr.go
+++ b/test/nilptr.go
@@ -38,6 +38,8 @@
shouldPanic(p8)
shouldPanic(p9)
shouldPanic(p10)
+ shouldPanic(p11)
+ shouldPanic(p12)
}
func shouldPanic(f func()) {
@@ -130,3 +132,23 @@
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)))
+}
« no previous file with comments | « src/cmd/8g/cgen.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b