Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/147.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ C++;铿锵UBsan抑制标志名称_C++_Clang++_Ubsan - Fatal编程技术网

C++ C++;铿锵UBsan抑制标志名称

C++ C++;铿锵UBsan抑制标志名称,c++,clang++,ubsan,C++,Clang++,Ubsan,使用clang的ubsan运行boost 1.64版中的gzip.hpp代码会给出以下消息: 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, sign

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

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)
在这种情况下,我希望这会起作用

implicit-integer-sign-change:/lfs/vlsi/tools/boost/*
但它在运行时提供

UndefinedBehaviorSanitizer: failed to parse suppressions
这面sanatizer旗的正确名称是什么

另见:

来自

-fsanize=隐式整数符号更改:如果更改了值的符号,则在整数类型之间进行隐式转换。也就是说,如果 原始值为负值,新值为正值(或 零),或者原始值为正值,而新值为 消极的此消毒剂捕获的问题不是未定义的行为, 但这往往是无意的


根据您正在阅读的本文档,您可以使用以下步骤抑制UBSan消息:

禁用仪表 带有属性((无清理(“未定义”))

您可以禁用特定函数的UBSan检查 使用
\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
of-fsanize=此属性中的标志,例如,如果您的函数
故意包含可能的有符号整数溢出,您可以
使用属性((无清理(“有符号整数溢出”))

<>此属性可能不受其他编译器支持,所以请考虑 与#ifdefined(clang)一起使用

因此,您应该做的是:检查同一页面中的文档,了解您想要抑制的内容,并将其与
使用属性(无清理(“这里有检查,您想要禁止”))。
使用属性(无清理(“未定义”)。
完全禁用UBSan

除此之外,UBSan似乎抛出了一个有符号整数溢出,而您正试图抑制无符号整数溢出


链接:

我在llvm cfe开发方面得到了帮助


TLDR:警告类型的名称不是
隐式整数符号更改
,而是
隐式整数截断
,可以按预期进行抑制。错误类型的名称可以使用
export UBSAN\u OPTIONS=report\u error\u type=1

找到
\u attribute\u
方式只是抑制UBSAN消息的一种方式。运行时抑制是我想使用的替代方法,因为我不想改变boost库。至于
无符号整数溢出
:这是我可以用于不同boost警告的标志。您是否尝试过使用
有符号整数溢出:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp
?我个人非常怀疑您是否可以使用除此之外的任何方法来抑制此特定错误
signed integer overflow
由于这显然是UBSan正在捕获的问题,我一定会让您失望,
signed integer overflow
确实得到了解析,但仍然报告了
gzip.hpp
。问题是关于运行时UBSan抑制的。
UndefinedBehaviorSanitizer: failed to parse suppressions