]> Cypherpunks repositories - gostls13.git/commit
cmd/dist: zero output variables on entry to goc2c functions
authorRuss Cox <rsc@golang.org>
Thu, 27 Mar 2014 18:05:31 +0000 (14:05 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 27 Mar 2014 18:05:31 +0000 (14:05 -0400)
commitf94bff7935d031f3114980715381af226ae3ac75
tree3a10b37fdaf6dac3779d31833f128bc9c1f77b57
parentef3c0e7e61ba1a670d69144b5ad8318166490ae8
cmd/dist: zero output variables on entry to goc2c functions

Zeroing the outputs makes sure that during function calls
in those functions we do not let the garbage collector
treat uninitialized values as pointers.

The garbage collector may still see uninitialized values
if a preemption occurs during the function prologue,
before the zeroing has had a chance to run.

This reduces the number of 'bad pointer' messages when
that runtime check is enabled, but it doesn't fix all of them,
so the check is still disabled.

It will also avoid leaks, although I doubt any of these were
particularly serious.

LGTM=iant, khr
R=iant, khr
CC=golang-codereviews
https://golang.org/cl/80850044
src/cmd/dist/goc2c.c