1
0
mirror of https://github.com/golang/go synced 2024-11-27 04:11:22 -07:00

cmd/gc: allow inlined struct == to mention unsafe.Pointer even in safe mode

Fixes #5578.

R=ken2
CC=golang-dev
https://golang.org/cl/13417044
This commit is contained in:
Russ Cox 2013-09-09 13:11:41 -04:00
parent 5b04d67091
commit 0218dfe7eb

View File

@ -340,7 +340,7 @@ walkexpr(Node **np, NodeList **init)
Node *r, *l, *var, *a;
NodeList *ll, *lr, *lpost;
Type *t;
int et;
int et, old_safemode;
int64 v;
int32 lno;
Node *n, *fn, *n1, *n2;
@ -488,7 +488,15 @@ walkexpr(Node **np, NodeList **init)
case ONE:
walkexpr(&n->left, init);
walkexpr(&n->right, init);
// Disable safemode while compiling this code: the code we
// generate internally can refer to unsafe.Pointer.
// In this case it can happen if we need to generate an ==
// for a struct containing a reflect.Value, which itself has
// an unexported field of type unsafe.Pointer.
old_safemode = safemode;
safemode = 0;
walkcompare(&n, init);
safemode = old_safemode;
goto ret;
case OANDAND: