Running the gzip.hpp
code from boost version 1.64 with clang's ubsan gives the following message:
path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp:674:16: runtime error: implicit conversion from type 'int' of value 139 (32-bit, signed) to type 'char' changed the value to -117 (8-bit, signed)
#0 0x7fed40b77bc2 in boost::iostreams::basic_gzip_compressor<std::allocator<char> >::basic_gzip_compressor(boost::iostreams::gzip_params const&, long)
I'd like to suppress this with with a suppression file. For other warnings this has worked:
unsigned-integer-overflow:path/to/boost/*
In this case I would expect that this should work
implicit-integer-sign-change:/lfs/vlsi/tools/boost/*
but it gives at runtime
UndefinedBehaviorSanitizer: failed to parse suppressions
What is the right name of this sanatizer flag?
See also: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions
and from https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks
-fsanitize=implicit-integer-sign-change: Implicit conversion between integer types, if that changes the sign of the value. That is, if the the original value was negative and the new value is positive (or zero), or the original value was positive, and the new value is negative. Issues caught by this sanitizer are not undefined behavior, but are often unintentional.
I have been helped on the llvm cfe-dev mailing list
TLDR: The name of the warning type is not implicit-integer-sign-change
but instead implicit-integer-truncation
which can be suppressed as expected. The name of the error type can be found out using export UBSAN_OPTIONS=report_error_type=1
.