OSDN Git Service

reflect: Fix invalid sharing in valueInterface.
[pf3gnuchains/gcc-fork.git] / libgo / go / reflect / value.go
index b25e5c7..5d08900 100644 (file)
@@ -841,7 +841,7 @@ func valueInterface(v Value, safe bool) interface{} {
        eface.typ = v.typ.runtimeType()
        eface.word = v.iword()
 
        eface.typ = v.typ.runtimeType()
        eface.word = v.iword()
 
-       if v.flag&flagIndir != 0 && v.typ.size > ptrSize {
+       if v.flag&flagIndir != 0 && v.kind() != Ptr && v.kind() != UnsafePointer {
                // eface.word is a pointer to the actual data,
                // which might be changed.  We need to return
                // a pointer to unchanging data, so make a copy.
                // eface.word is a pointer to the actual data,
                // which might be changed.  We need to return
                // a pointer to unchanging data, so make a copy.