Skip to content

Commit

Permalink
cmd/compile: do not inline functions marked cgo_unsafe_args
Browse files Browse the repository at this point in the history
Now the net tests pass with -gcflags '-l=4'.

Fixes #18125.

Change-Id: I4e3a46eb0cb3a93b203e74f5bc99c5822331f535
Reviewed-on: https://go-review.googlesource.com/33722
Reviewed-by: Keith Randall <khr@golang.org>
  • Loading branch information
davidlazar committed Dec 1, 2016
1 parent 3c2e4ed commit 9fbfe7c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cmd/compile/internal/gc/inl.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ func caninl(fn *Node) {
return
}

// If marked "go:cgo_unsafe_args", don't inline
if fn.Func.Pragma&CgoUnsafeArgs != 0 {
reason = "marked go:cgo_unsafe_args"
return
}

// If fn has no body (is defined outside of Go), cannot inline it.
if fn.Nbody.Len() == 0 {
reason = "no function body"
Expand Down

0 comments on commit 9fbfe7c

Please sign in to comment.