Commit 0218dfe7 authored by Russ Cox's avatar Russ Cox

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
parent 5b04d670
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment