summaryrefslogtreecommitdiff
path: root/misc/cgo/test/callback_c_gc.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-16 15:00:08 -0400
committerRuss Cox <rsc@golang.org>2014-10-16 15:00:08 -0400
commit78db2eb9c66d478bee0d56edcc55d4f865f8c6c7 (patch)
treed08da7ddd82570422ae87dc9d3ac061f8ce3b648 /misc/cgo/test/callback_c_gc.c
parentaf64ab79c0ad72decf083d78cf54257d009741b5 (diff)
parent25c63c2c30f4807b073f849d248144d97893ce70 (diff)
downloadgo-78db2eb9c66d478bee0d56edcc55d4f865f8c6c7.tar.gz
all: merge default branch into dev.garbage
hg was unable to create a CL on the code review server for this, so I am submitting the merge by hand. The only manual edits are in mgc0.c, to reapply the removal of cached/ncached to the new code.
Diffstat (limited to 'misc/cgo/test/callback_c_gc.c')
-rw-r--r--misc/cgo/test/callback_c_gc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/misc/cgo/test/callback_c_gc.c b/misc/cgo/test/callback_c_gc.c
index 32bfed0c0..28a62c6db 100644
--- a/misc/cgo/test/callback_c_gc.c
+++ b/misc/cgo/test/callback_c_gc.c
@@ -39,6 +39,16 @@ callCgoAllocate(void)
int i;
struct { size_t n; void *ret; } a;
List *l, *head, **tail;
+
+ // Make sure this doesn't crash.
+ // And make sure it returns non-nil.
+ a.n = 0;
+ a.ret = 0;
+ crosscall2(_cgo_allocate, &a, sizeof a);
+ if(a.ret == 0) {
+ fprintf(stderr, "callCgoAllocate: alloc 0 returned nil\n");
+ exit(2);
+ }
head = 0;
tail = &head;