Skip to content

cmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16 #64691

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/cmd/cgo/internal/testsanitizers/msan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ func TestMSAN(t *testing.T) {
defer dir.RemoveAll(t)

outPath := dir.Join(name)
mustRun(t, config.goCmdWithExperiments("build", []string{"-o", outPath, srcPath(tc.src)}, tc.experiments))
buildcmd := config.goCmdWithExperiments("build", []string{"-o", outPath, srcPath(tc.src)}, tc.experiments)
// allow tests to define -f flags in CGO_CFLAGS
replaceEnv(buildcmd, "CGO_CFLAGS_ALLOW", "-f.*")
mustRun(t, buildcmd)

cmd := hangProneCmd(outPath)
if tc.wantErr {
Expand Down
7 changes: 7 additions & 0 deletions src/cmd/cgo/internal/testsanitizers/testdata/msan8.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
package main

/*
// For clang >= 16, uninitialized memory is more aggressively reported.
// Restore the old behavior for this particular test as it relies on
// uninitialized variables. See #64616
#if __clang_major__ >= 16
#cgo CFLAGS: -fno-sanitize-memory-param-retval
#endif

#include <pthread.h>
#include <signal.h>
#include <stdint.h>
Expand Down