主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

数据流缺陷

与数据流编码错误相关的缺陷,如不可达代码、未初始化、缺少返回语句、无用的写入等

这些缺陷是与信息在整个代码中的流动方式相关的错误。这些缺陷包括:

  • 死代码或不可达代码

  • 未使用的代码

  • 未初始化的信息

Polyspace 结果

由始终为 false 的条件停用的代码Code segment deactivated by #if 0 directive or if(0) condition
死代码Code does not execute
无限循环Loop termination condition might never be satisfied (自 R2023a 起)
缺失 return 语句Function with non-void return type does not return value on some paths
未初始化的变量Variable not initialized before use
未初始化的指针Pointer not initialized before dereference
未完整访问的数组Array partly read or written before end of scope
指向未初始化值的指针转换为常量指针Pointer to constant assigned address that does not contain a value
静态未调用函数Function with static scope not called in file
不可达代码Code not executed because of preceding control-flow statements
无用的 if 条件Unnecessary if conditional
无用预处理器条件句指令Preprocessor conditional directive is always true or always false (自 R2022a 起)
变量遮蔽Variable hides another variable of same name with nested scope
写入后未被读取Variable never read after assignment

主题

  • Bug Finder Defect Groups

    The Bug Finder defect checkers are classified into groups such as data flow, concurrency, numerical, and so on.