From 92a1190c6c97aeeae50a2579ba0f23e257719e02 Mon Sep 17 00:00:00 2001 From: Ken Thompson Date: Tue, 9 Dec 2008 13:00:50 -0800 Subject: [PATCH] robs bug converting unsafe.pointer R=r OCL=20834 CL=20834 --- src/cmd/gc/go.h | 1 + src/cmd/gc/subr.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h index dc6de63c6c6..775a4cca12d 100644 --- a/src/cmd/gc/go.h +++ b/src/cmd/gc/go.h @@ -156,6 +156,7 @@ struct Type uchar embedded; // TFIELD embedded type uchar siggen; uchar funarg; + uchar copyany; // TFUNCT uchar thistuple; diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index cd2fc4d2d53..5638df4b7dd 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -1779,6 +1779,8 @@ loop: goto loop; case TANY: + if(!st->copyany) + return 0; *stp = t; break; @@ -1841,6 +1843,11 @@ deep(Type *t) nt = t; // share from here down break; + case TANY: + nt = shallow(t); + nt->copyany = 1; + break; + case TPTR32: case TPTR64: case TCHAN: