From 774cb81796a09a54f34b2295c7f40cec812c42be Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov Date: Wed, 28 Dec 2016 15:52:54 -0800 Subject: Disable global coverage when a module disables asan. With SANITIZE_TARGET="address coverage", if a module disables ASan (address: false), it is left with just coverage, which is not supported. In that case, disable coverage as well. Bug: 33091541 Test: see above Change-Id: Idcd04dad8cab7c7e2644d2408b1b8a381490e5af --- cc/sanitize.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'cc') diff --git a/cc/sanitize.go b/cc/sanitize.go index dca58d88..79c86aaa 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -136,8 +136,14 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) { s.Undefined = boolPtr(true) } - if found, globalSanitizers = removeFromList("address", globalSanitizers); found && s.Address == nil { - s.Address = boolPtr(true) + if found, globalSanitizers = removeFromList("address", globalSanitizers); found { + if s.Address == nil { + s.Address = boolPtr(true) + } else if *s.Address == false { + // Coverage w/o address is an error. If globalSanitizers includes both, and the module + // disables address, then disable coverage as well. + _, globalSanitizers = removeFromList("coverage", globalSanitizers) + } } if found, globalSanitizers = removeFromList("thread", globalSanitizers); found && s.Thread == nil { -- cgit v1.2.3