From: Tobias Klauser Date: Thu, 17 Mar 2022 21:39:53 +0000 (+0100) Subject: runtime/cgo: remove memset in _cgo_sys_thread_start on freebsd/arm X-Git-Tag: go1.19beta1~1024 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=adfee1e1e7b3236770c19d255e945613a53a34cc;p=gostls13.git runtime/cgo: remove memset in _cgo_sys_thread_start on freebsd/arm pthread_attr_init on freebsd properly initializes the pthread_attr, there is no need to zero it before the call. The comment and code were probably copied from the linux/arm implementation. This aligns the implementation on freebsd/arm with the implementation on other freebsd architectures. Fixes #44248 Change-Id: If82ebb115b877b6c6f4862018a9419ba8d870f12 Reviewed-on: https://go-review.googlesource.com/c/go/+/393617 Trust: Tobias Klauser Run-TryBot: Tobias Klauser Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Reviewed-by: Hajime Hoshi Trust: Hajime Hoshi --- diff --git a/src/runtime/cgo/gcc_freebsd_arm.c b/src/runtime/cgo/gcc_freebsd_arm.c index 74f2e0ede5..5f89978379 100644 --- a/src/runtime/cgo/gcc_freebsd_arm.c +++ b/src/runtime/cgo/gcc_freebsd_arm.c @@ -37,7 +37,6 @@ x_cgo_init(G *g, void (*setg)(void*)) pthread_attr_destroy(&attr); } - void _cgo_sys_thread_start(ThreadStart *ts) { @@ -50,12 +49,7 @@ _cgo_sys_thread_start(ThreadStart *ts) SIGFILLSET(ign); pthread_sigmask(SIG_SETMASK, &ign, &oset); - // Not sure why the memset is necessary here, - // but without it, we get a bogus stack size - // out of pthread_attr_getstacksize. C'est la Linux. - memset(&attr, 0, sizeof attr); pthread_attr_init(&attr); - size = 0; pthread_attr_getstacksize(&attr, &size); // Leave stacklo=0 and set stackhi=size; mstart will do the rest. ts->g->stackhi = size;