turn on -fsanitize=integer on portable bot
There's one place where we're harmlessly underflowing
a U32, the not-taken side of an if_then_else(). Rather
than do something awkward to work around it, just stifle.
Change-Id: Ifb983cffb6c2a6c9281f5ec0bc0d67021bf82741
Reviewed-on: https://skia-review.googlesource.com/144622
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/build/clang.xsan-portable b/build/clang.xsan-portable
index f0ccef7..b825f41 100644
--- a/build/clang.xsan-portable
+++ b/build/clang.xsan-portable
@@ -1,6 +1,4 @@
mode = .xsan-portable
-extra_cflags = -fsanitize=address,undefined -fno-sanitize-recover=all -DSKCMS_PORTABLE
-extra_ldflags = -fsanitize=address,undefined
+extra_cflags = -fsanitize=address,integer,undefined -fno-sanitize-recover=all -DSKCMS_PORTABLE
+extra_ldflags = -fsanitize=address,integer,undefined
include build/clang
-
-# TODO: add -fsanitize=integer
diff --git a/src/Transform_inl.h b/src/Transform_inl.h
index 8cc9f77..49d324a 100644
--- a/src/Transform_inl.h
+++ b/src/Transform_inl.h
@@ -140,6 +140,11 @@
#endif
}
+#if defined(__clang__)
+ // The -((127-15)<<10) underflows that side of the math when
+ // we pass a denorm half float. It's harmless... we'll take the 0 side anyway.
+ __attribute__((no_sanitize("unsigned-integer-overflow")))
+#endif
SI ATTR U16 Half_from_F(F f) {
#if defined(USING_NEON_F16C)
return (U16)vcvt_f16_f32(f);