数据流检查
Polyspace® Code Prover™ 中的数据流检查用于检查与程序中的信息流相关的运行时错误,例如:
正在读取的变量是否已初始化。
条件语句的分支是否可达。
在运行时是否调用某个函数。
Polyspace 结果
未调用函数 | 函数已定义但未调用 |
不可达函数 | Function is called from unreachable part of code |
全局变量未在初始化代码中赋值 | Global variable is not assigned a value in the initialization section of program |
未初始化的局部变量 | Local variable is not initialized before being read |
未初始化的指针 | Pointer is not initialized before being read |
未初始化的变量 | 不是局部变量的变量在被读取前未初始化 |
返回值未初始化 | C function does not return value when expected |
不可达代码 | 在执行期间无法到达的代码 |
主题
- Review and Fix Function Not Called Checks
Investigate why a function does not appear in the call graph starting from the
main
or another entry point. - Review and Fix Function Not Reachable Checks
Identify the call sites of a function and investigate why they occur in unreachable code.
- Review and Fix Return Value Not Initialized Checks
Identify paths through your function body that do not end in a
return
statement. - Review and Fix Non-initialized Local Variable Checks
Locate prior variable initializations if any and see if your program can bypass them.
- Review and Fix Non-initialized Pointer Checks
Locate prior pointer initializations if any and see if your program can bypass them.
- Review and Fix Non-initialized Variable Checks
Locate prior initializations of the global variable if any and see if your program can bypass them.
- Review and Fix Unreachable Code Checks
Investigate why a conditional statement in your code is redundant, for instance, always true or always false.
- Find Relations Between Variables in Code
Determine if the variables in any operation are related from some previous operation.