HP-UX Cadvise Diagnostics Reference Guide (5900-1865, August 2012)

Table Of Contents
-- file1.c ----
typedef struct {
int f;
int g;
} A;
A global; // LINE 6
void print_A(A par) // LINE 8
{
printf("%d %d", par.f, par.g);
}
-- file2.c ----
typedef struct {
int f;
char g; // Should be: int g;
} A;
A global;
void print_A(A);
main()
{
print_A(global);
}
"file1.c", line 8: warning #20048-D: Function "print_A" has incompatible
type with previous declaration at line 8 in file "file2.c"
"file2.c", line 6: warning #20048-D: Variable "global" has incompatible
type with previous declaration at line 6 in file "file1.c"
Action:
In the case of mismatch for a global variable, review the 2 locations specified in the warning and
make sure that the declared global types match. In the case of a function, review the 2 locations
specified in the warning and verify that the types of the arguments and return value match for the
two function declarations. This problem can usually be avoided by using header files to declare
types or functions used across multiple source files.
Reference:
20072 variable %s is partially uninitialized when used
Cause:
An element in an array or a field of a struct is being referenced prior to its initialization.
Example:
int a[10];
a[9] = 12;
foo(a); // warning 20072: elements 0-8 are uninitialized
Action:
Ensure that all elements/fields of an array/struct are initialized prior to passing it as a function
argument. .
Reference:
20073 variable %s may be partially uninitialized when used
Cause:
An element in an array or an unnamed field of a struct may be referenced prior to its initialization.
Example:
int a[2];
a[0] = 10;
if (cond)
a[1] = 12;
foo(a); // warning 20073: element 1 may be uninitialized
Action:
Ensure that all elements/fields of an array/struct are unconditionally initialized prior to accessing
them.
20072 variable %s is partially uninitialized when used 73