diff options
author | Manoj Gupta <manojgupta@google.com> | 2019-10-11 10:49:21 -0700 |
---|---|---|
committer | Manoj Gupta <manojgupta@chromium.org> | 2019-10-11 18:57:34 +0000 |
commit | c08e01d98e72f2e9dffd73a7fd3d011f2a251ac9 (patch) | |
tree | 955fd03ab874fd6b735a3d309d031afefd5723a0 /compiler_wrapper/sanitizer_flags_test.go | |
parent | 6ecb3475254b6ab7ab3be6a2f58abc2f2fdd3da8 (diff) | |
download | toolchain-utils-c08e01d98e72f2e9dffd73a7fd3d011f2a251ac9.tar.gz |
compiler_wrapper: Disable new pass manager with sanitizers+coverage.
Useing sanitizers and coverage together in new pass manager
causes clang to crash.
Avoid the crash by disabling new pass manager in these cases.
BUG=chromium:1013622
TEST=go test
Change-Id: Ifc787e9f288891e3e1b68c791f0ddaa508d8c816
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1856379
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/sanitizer_flags_test.go')
-rw-r--r-- | compiler_wrapper/sanitizer_flags_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/compiler_wrapper/sanitizer_flags_test.go b/compiler_wrapper/sanitizer_flags_test.go index 741f7732..8f50a900 100644 --- a/compiler_wrapper/sanitizer_flags_test.go +++ b/compiler_wrapper/sanitizer_flags_test.go @@ -119,3 +119,34 @@ func TestOmitFuzzerFlagsForGcc(t *testing.T) { } }) } + +func TestAddSanitizerCoverageFlagsForClang(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(clangX86_64, "-fsanitize=address", "-fprofile-instr-generate", mainCc))) + if err := verifyArgOrder(cmd, "-fno-experimental-new-pass-manager", + "-fsanitize=address", "-fprofile-instr-generate", mainCc); err != nil { + t.Error(err) + } + }) +} + +func TestOmitSanitizerCoverageFlagsForClang(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(clangX86_64, "-fsanitize=address", mainCc))) + if err := verifyArgCount(cmd, 0, "-fno-experimental-new-pass-manager"); err != nil { + t.Error(err) + } + }) +} + +func TestKeepSanitizerCoverageFlagsForClang(t *testing.T) { + withTestContext(t, func(ctx *testContext) { + cmd := ctx.must(callCompiler(ctx, ctx.cfg, + ctx.newCommand(clangX86_64, "-fprofile-instr-generate", mainCc))) + if err := verifyArgCount(cmd, 0, "-fno-experimental-new-pass-manager"); err != nil { + t.Error(err) + } + }) +} |