Insure++ Reference - EXPR_WILD
This error is generated whenever a program operates on a memory region
that is unknown to Insure++. This can come about in two ways:
- Errors in user code that result in pointers that don't point at any
known memory block.
- Compiling only some of the files that make up an application.
This can result in Insure++ not knowing enough about memory
usage to distinguish correct and erroneous behavior.
This discussion centers on the first type of problem described here.
A detailed discussion of the second topic, including samples of its
generation and repair can be found in
"Interfaces".
The following code attempts to use the address of a local variable but
contains an error at line 8 - the address operator (& )
has been omitted.
1: /*
2: * File: expwld1.c
3: */
4: main()
5: {
6: int i = 123, j=345, *a;
7:
8: a = i;
9: if(a > &i)
10: a = &j;
11: return (0);
12: }
[expwld1.c:9] **EXPR_WILD**
1. >> if(a > &i)
2. Expression uses wild pointer: a > &i
3. Pointer : 0x0000007b
Stack trace where the error occurred:
4. main() expwld1.c,
- Source line at which the problem was detected.
- Description of the problem and the name of the parameter
that is in error.
- Value of the wild pointer.
- Stack trace showing the function call sequence leading to
the error.
Note that most compilers will generate warning messages for this error
since the assignment in line 8 uses incompatible types.
A more insidious version of the same problem can occur when using
union types. The following code first assigns the pointer
element of a union but then overwrites it with another element before
finally attempting to use it.
1: /*
2: * File: expwld2.c
3: */
4: union {
5: int *ptr;
6: int ival;
7: } u;
8:
9: main()
10: {
11: int i = 123, j=345;
12:
13: u.ptr = &i;
14: u.ival = i;
15: if(u.ptr > &j)
16: u.ptr = &j;
17: return (0);
18: }
Note that this code will not generate compile time errors.
[expwld2.c:15] **EXPR_WILD**
1. >> if(u.ptr > &j)
2. Expression uses wild pointer: u.ptr > &j
3. Pointer : 0x0000007b
Stack trace where the error occurred:
4. main() expwld2.c, 15
- Source line at which the problem was detected.
- Description of the problem and the name of the parameter
that is in error.
- Value of the bad pointer.
- Stack trace showing the function call sequence leading to the error.
The simpler types of problem are most conveniently tracked in a
debugger by stopping the program at the indicated source line. You should
then examine the illegal value and attempt to see where it was generated.
Alternatively you can stop the program at some point prior to the error
and single-step it through the code leading up to the error.
"Wild pointers" can also be generated when Insure++
has only partial information about your program's structure. This issue
is discussed extensively in
"Interfaces".
EXPR_UNRELATED_PTRDIFF
FREE_BODY
|