Skip to content

Commit 9fbfe7c

Browse files
committed
cmd/compile: do not inline functions marked cgo_unsafe_args
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 <[email protected]>
1 parent 3c2e4ed commit 9fbfe7c

File tree

1 file changed

+6
-0
lines changed
  • src/cmd/compile/internal/gc

1 file changed

+6
-0
lines changed

src/cmd/compile/internal/gc/inl.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ func caninl(fn *Node) {
107107
return
108108
}
109109

110+
// If marked "go:cgo_unsafe_args", don't inline
111+
if fn.Func.Pragma&CgoUnsafeArgs != 0 {
112+
reason = "marked go:cgo_unsafe_args"
113+
return
114+
}
115+
110116
// If fn has no body (is defined outside of Go), cannot inline it.
111117
if fn.Nbody.Len() == 0 {
112118
reason = "no function body"

0 commit comments

Comments
 (0)