• Bryan C. Mills's avatar
    runtime/cgo: defeat inlining in x_cgo_yield · e0545faf
    Bryan C. Mills authored
    We use a call to strncpy to work around a TSAN bug (wherein TSAN only
    delivers asynchronous signals when the thread receiving the signal
    calls a libc function). Unfortunately, GCC 7 inlines the call,
    avoiding the TSAN libc trap entirely.
    
    Per Ian's suggestion, use global variables as strncpy arguments: that
    way, the compiler can't make any assumptions about the concrete values
    and can't inline the call away.
    
    fixes #21196
    
    Change-Id: Ie95f1feaf9af1a8056f924f49c29cfc8515385d7
    Reviewed-on: https://go-review.googlesource.com/55872Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    e0545faf
gcc_util.c 1.85 KB