Uninitialized Variables Read
The Uninitialized Variables Read report shows global, static and local variables that are read before they are ever initialized or set. The existence of this condition may be result from a simple failure to initialize the variables, or might indicate that some logic is faulty or missing. Consider the following example:
int globalA, globalB, globalC;
int func2(int paramW, int paramX) {
int localA;
localA = globalA;
localA = globalB;
localA = globalC;
return localA;
}
int func1(void) {
int localW = 1;
int localX, localY, localZ;
int decision = 1;
globalA = localW;
if (decision) {
globalB = localW;
globalC = localW;
} else {
globalC = localW;
}
localY = func2(localW, localX);
return localZ;
}
|
In the resulting report, localX and localZ are listed, as they are both read within func1 without having been initialized. The variable globalB is also reported, because its initialization is dependent on an if condition, while globalC is initialized regardless of whether or not the if condition is met.
Uninitialized Variables Read
Settings:
Global Variables: displayed
Static Variables: displayed
Struct Container Summary: omitted
Union/Bitfield Members: separate
Task Definitions
Tasks are from Auto Task Generation: Any root functions
Name Members Graph Root
autotask 1 - func1 2 [+] func1
Variable File (Line)
Function File (Line)
Assignment
globalB uninit_vars_read.c (2)
func2 uninit_vars_read.c (4)
7 localA = globalB;
localX uninit_vars_read.c (13)
func1 uninit_vars_read.c (11)
22 localY = func2(localW, localX);
localZ uninit_vars_read.c (13)
func1 uninit_vars_read.c (11)
23 return localZ;
|
Note that task definitions are included in this report. The report does take task definitions into account in determining the starting points for the data flow. However, this report is not one of the Task Flow Checks, and there is no need to manually define the tasks (see the Task Flow Checks section of the User Guide).
|