C++ clang UBsan 抑制标志名称

Elr*_*337 6 c++ clang++ ubsan

使用 clang 的 ubsan运行gzip.hppboost 版本 1.64 中的代码会给出以下消息:

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)
Run Code Online (Sandbox Code Playgroud)

我想用抑制文件来抑制这种情况。对于其他警告,这有效:

 unsigned-integer-overflow:path/to/boost/*
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我希望这应该有效

implicit-integer-sign-change:/lfs/vlsi/tools/boost/*
Run Code Online (Sandbox Code Playgroud)

但它在运行时给出

UndefinedBehaviorSanitizer: failed to parse suppressions
Run Code Online (Sandbox Code Playgroud)

这个消毒标志的正确名称是什么?

另请参阅:https ://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions

以及来自https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks

-fsanitize=implicit-integer-sign-change:整数类型之间的隐式转换(如果改变值的符号)。也就是说,如果原始值为负,新值为正(或零),或者原始值为正,新值为负。这种消毒剂发现的问题不是未定义的行为,但通常是无意的。

Elr*_*337 6

我在 llvm cfe-dev邮件列表上得到了帮助

TLDR:警告类型的名称不是implicit-integer-sign-change,而是implicit-integer-truncation可以按预期抑制。可以使用 找到错误类型的名称export UBSAN_OPTIONS=report_error_type=1