主要内容

数值缺陷

与数值编码错误相关的缺陷,如除以零、类型转换、负移位运算、数学标准库等

这些缺陷是与代码中的变量及其值、数据类型以及用法相关的错误。这些缺陷包括:

  • 数学运算

  • 转换溢出

  • 运算溢出

Polyspace 结果

全部展开

对负值执行按位运算对负值执行按位运算的未定义行为
整数常量溢出Constant value falls outside range of integer data type
整数转换溢出在整数类型之间转换时发生溢出
整数除以零Dividing integer number by zero
整数溢出Overflow from operation between integers
超出整数精度 Operation using integer size instead of precision can cause undefined behavior
无效的标准库整数例程使用Wrong arguments to standard library function
可能无效的布尔操作数运算Operation can exceed precision of Boolean operand or result in arbitrary value
从整数转换为浮点数的精度损失在将整数转换为浮点数类型时丢失的最低有效位
移位操作的右操作数超出允许范围Overflow from shifting operation
负值移位Shift operator on negative value
符号变化整数转换溢出Overflow when converting between signed and unsigned integers
无符号整数转换溢出在不同无符号整数类型之间转换时发生溢出
无符号整数溢出Overflow from operation between unsigned integers
无符号整数常量溢出Constant value falls outside range of unsigned integer data type
对数值使用纯字符类型Plain char variable in arithmetic operation without explicit signedness
浮点操作数被吸收One addition or subtraction operand is absorbed by the other operand
浮点数转换溢出Overflow when converting between floating point data types
浮点数除以零Dividing floating point number by zero
浮点溢出Overflow from operation between floating points
无效的标准库浮点例程使用Wrong arguments to standard library function

主题