Skip to content

Commit

Permalink
go-fuzz-build: do not instrument package reflect
Browse files Browse the repository at this point in the history
This is unfortunate, but it circumvents a build failure:

failed to execute go build: exit status 1
# reflect
/Users/josh/go/1.21/src/reflect/value.go:3958: misplaced compiler directive

The problem is that in this code:

//go:nosplit
func noescape(p unsafe.Pointer) unsafe.Pointer {

The nosplit gets separated from the func, and placed
in the body of the function above it. Oops.

We could probably be more careful and make this work,
but the fix is non-obvious, and probably not even in this package.

This project is on life support.
Ignoring reflect is the simplest possible fix.
  • Loading branch information
josharian committed Oct 19, 2023
1 parent 5f6182e commit 5581da8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go-fuzz-build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ func (c *Context) calcIgnore() {
// noisy (because they are low level), and/or not interesting.
// We could manually maintain this list, but that makes go-fuzz-build
// fragile in the face of internal standard library package changes.
roots := c.packagesNamed("runtime", "github.com/dvyukov/go-fuzz/go-fuzz-dep")
roots := c.packagesNamed("runtime", "reflect", "github.com/dvyukov/go-fuzz/go-fuzz-dep")
packages.Visit(roots, func(p *packages.Package) bool {
c.ignore[p.PkgPath] = true
return true
Expand Down

0 comments on commit 5581da8

Please sign in to comment.