Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: //go:norace should prohibit inlining into functions that will be instrumented #24651

mdempsky opened this issue Apr 2, 2018 · 1 comment


Copy link

@mdempsky mdempsky commented Apr 2, 2018

Currently, compiling this package:

package p

func F(p *int) { g(p) }

func g(p *int) { *p = 0 }

with "-S -race" shows that g is inlined into F, and the pointer assignment is instrumented with a race detector call, which seemingly defeats the intention of adding //go:norace.

Probably the easiest solution is that when instrumenting, we should treat //go:norace functions as non-inlinable.

Even better would be to avoid inlining //go:norace function calls only into instrumented functions (similar to how CL 102815 still allows inlining runtime calls within package runtime even during instrumented builds), but that would require tracking the //go:norace pragma across compilation units, which is a bit more involved.

/cc @cherrymui

@mdempsky mdempsky added this to the Go1.11 milestone Apr 2, 2018
@dr2chase dr2chase self-assigned this Jun 15, 2018
Copy link

@gopherbot gopherbot commented Jun 15, 2018

Change mentions this issue: cmd/compile: conditional on -race, disable inline of go:norace

@gopherbot gopherbot closed this in c6e455b Jun 19, 2018
@golang golang locked and limited conversation to collaborators Jun 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants