aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-unsafe-pointer.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/go-unsafe-pointer.c')
-rw-r--r--libgo/runtime/go-unsafe-pointer.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libgo/runtime/go-unsafe-pointer.c b/libgo/runtime/go-unsafe-pointer.c
index ca1d253..b71804a 100644
--- a/libgo/runtime/go-unsafe-pointer.c
+++ b/libgo/runtime/go-unsafe-pointer.c
@@ -9,6 +9,9 @@
#include "runtime.h"
#include "go-type.h"
+/* A pointer with a zero value. */
+static void *zero_pointer;
+
/* This file provides the type descriptor for the unsafe.Pointer type.
The unsafe package is defined by the compiler itself, which means
that there is no package to compile to define the type
@@ -53,7 +56,9 @@ const struct __go_type_descriptor unsafe_Pointer =
/* __uncommon */
NULL,
/* __pointer_to_this */
- NULL
+ NULL,
+ /* __zero */
+ &zero_pointer
};
/* We also need the type descriptor for the pointer to unsafe.Pointer,
@@ -94,7 +99,9 @@ const struct __go_ptr_type pointer_unsafe_Pointer =
/* __uncommon */
NULL,
/* __pointer_to_this */
- NULL
+ NULL,
+ /* __zero */
+ &zero_pointer
},
/* __element_type */
&unsafe_Pointer