This page provides an overview of each error code. The following sections provide a detailed description of each error including:
- A brief explanation of what problem has been detected.
- An example program that generates a similar error.
- Output that would be generated by running the example, with annotations indicating what the various pieces of the diagnostic mean and how they should be interpreted in identifying your own problems. The exact appearance of the error message may depend on how Insure++ is currently configured.
- A brief description of ways in which the problem might be eliminated.
Sometimes you will see values identified as <argument #> or <return> instead of names from your program. In this case, <argument n> refers to the nth argument passed to the current function (i.e., the argument where the error was detected), and <return> refers to a value returned from the function indicated.
ALLOC_CONFLICT
| Code | Description | Enabled | Reported |
|---|---|---|---|
| ALLOC_CONFLICT | Mixing malloc/free with new/ delete | Runtime | |
| (badfree) | Memory was allocated with | Runtime | |
| (baddelet) | Memory was allocated with | Runtime | |
| (badhandle) | Memory is allocated by one heap and freed by a different heap | Runtime |
BAD_CAST
| Code | Description | Enabled | Reported |
|---|---|---|---|
| BAD_CAST | Cast of pointer loses precision | Compilation |
BAD_DECL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| BAD_DECL | Incompatible global declarations | Runtime |
BAD_FORMAT
| Code | Description | Enabled | Reported |
|---|---|---|---|
| BAD_DECL | Incompatible global declarations | Compilation Runtime | |
| (sign) | Types differ only by sign, e.g., int vs. unsigned int | Compilation | |
| (compatible) | Fundamental types are different but they happen to have the same representation on the particular hardware in use, e.g., int vs. long on machines where both are 32-bits, or int * vs. long where both are 32-bits. | Compilation | |
| (incompatible) | Fundamental types are different, e.g., int vs. double | Runtime | |
| (other) | A problem other than an argument type mismatch is detected, such as passing the wrong number of arguments. Error messages are classified according to this scheme and can be selectively enabled or disabled | Compilation |
BAD_PARM
| Code | Description | Enabled | Reported |
|---|---|---|---|
| BAD_PARM | Mismatch in argument type. | Compilation | |
| (sign) | Types differ only by sign, e.g., int vs. unsigned int | Compilation | |
| (compatible) | Fundamental types are different but they happen to have the same representation on the particular hardware in use, e.g., | Compilation | |
| (incompatible) | Fundamental types are different, e.g., int vs. double | Compilation | |
| (pointer) | This is not an error class, but a keyword used to suppress messages about mismatched pointer types, such as | Compilation | |
| (union) | Forces a declared union argument to match only a similar union as an actual argument. If this is suppressed, you may pass any of the individual union elements to the routine, rather than the union type, or pass a union to a routine which expects one of the union-elements as an argument. | Compilation | |
| (other) | A problem other than an argument type mismatch is detected, such as passing the wrong number of arguments. Error messages are classified according to this scheme and can be selectively enabled or disabled | Compilation |
BOGUS_LEAK
| Code | Description | Enabled | Reported |
|---|---|---|---|
| BOGUS_LEAK | Runtime leak not found during execution | Runtime |
COPY_BAD_RANGE
| Code | Description | Enabled | Reported |
|---|---|---|---|
| COPY_BAD_RANGE | Attempt to copy out-of-range pointer | Runtime |
COPY_DANGLING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| COPY_DANGLING | Attempt to copy dangling pointer | Runtime |
COPY_UNINIT_PTR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| COPY_UNINIT_PTR | Attempt to copy uninitialized pointer | Runtime |
COPY_WILD
| Code | Description | Enabled | Reported |
|---|---|---|---|
| COPY_UNINIT_PTR | Attempt to copy a wild pointer | Runtime |
DEAD_CODE
| Code | Description | Enabled | Reported |
|---|---|---|---|
| DEAD_CODE | Code is not evaluated, has no effect, or is unreachable | Compilation | |
| (emptyloopbody) | Loop body is empty. | Compilation | |
| (emptystmt) | The statement is empty. | Compilation | |
| (noeffect) | Code has no effect. | Compilation | |
| (notevaluated) | Code is not evaluated. | Compilation |
DELETE_MISMATCH
| Code | Description | Enabled | Reported |
|---|---|---|---|
| DELETE_MISMATCH | Mismatch between | Runtime | |
| (bracket) |
| Runtime | |
| (nobracket) |
| Runtime |
EXPR_BAD_RANGE
| Code | Description | Enabled | Reported |
|---|---|---|---|
| EXPR_BAD_RANGE | Expression exceeded range | Runtime |
EXPR_DANGLING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| EXPR_DANGLING | Expression uses a dangling pointer | Runtime |
EXPR_NULL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| EXPR_NULL | Expression uses | Runtime |
EXPR_UNINIT_PTR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| EXPR_UNINIT_PTR | Expression uses uninitialized pointer | Runtime |
EXPR_UNRELATED_PTRCMP
| Code | Description | Enabled | Reported |
|---|---|---|---|
| EXPR_UNRELATED_PTRCMP | Expression compares unrelated pointers | Runtime |
EXPR_UNRELATED_PTRDIFF
| Code | Description | Enabled | Reported |
|---|---|---|---|
| EXPR_UNRELATED_PTRDIFF | Expression subtracts unrelated pointers | Runtime |
EXPR_WILD
| Code | Description | Enabled | Reported |
|---|---|---|---|
| EXPR_WILD | Expression uses a wild pointer | Runtime |
FREE_BODY
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FREE_BODY | Freeing memory block from body | Runtime |
FREE_DANGLING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FREE_DANGLING | Freeing dangling pointer | Runtime |
FREE_GLOBAL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FREE_GLOBAL | Freeing global memory | Runtime |
FREE_LOCAL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FREE_LOCAL | Freeing local memory | Runtime |
FREE_NULL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FREE_NULL | Freeing null pointer | Runtime |
FREE_UNINIT_PTR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FREE_UNINIT_PTR | Freeing uninitialized pointer | Runtime |
FREE_WILD
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FREE_WILD | Freeing wild pointer | Runtime |
FUNC_BAD
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FUNC_BAD | Function pointer is not a function | Runtime |
FUNC_NULL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FUNC_NULL | Function pointer is | Runtime |
FUNC_UNINIT_PTR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| FUNC_UNINIT_PTR | Function pointer is uninitialized | Runtime |
HEAP_CORRUPT
| Code | Description | Enabled | Reported |
|---|---|---|---|
| HEAP_CORRUPT | Dynamic memory heap is corrupt | Runtime |
INSURE_ERROR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| INSURE_ERROR | Various internal errors | Runtime, Compilation |
INSURE_WARNING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| INSURE_WARNING | Errors from | Compilation |
LEAK_ASSIGN
| Code | Description | Enabled | Reported |
|---|---|---|---|
| LEAK_ASSIGN | Memory leaked as a result of pointer reassignment | Runtime |
LEAK_FREE
| Code | Description | Enabled | Reported |
|---|---|---|---|
| LEAK_ASSIGN | Memory leaked freeing block | Runtime |
LEAK_RETURN
| Code | Description | Enabled | Reported |
|---|---|---|---|
| LEAK_RETURN | Memory leaked by ignoring returned value | Runtime |
LEAK_SCOPE
| Code | Description | Enabled | Reported |
|---|---|---|---|
| LEAK_RETURN | Memory leaked leaving scope | Runtime |
PARM_BAD_RANGE
| Code | Description | Enabled | Reported |
|---|---|---|---|
| PARM_BAD_RANGE | Array parameter exceeded range | Runtime |
PARM_DANGLING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| PARM_DANGLING | Array parameter is a dangling pointer | Runtime |
PARM_NULL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| PARM_NULL | Array parameter is | Runtime |
PARM_UNINIT_PTR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| PARM_UNINIT_PTR | Array parameter is an uninitialized pointer | Runtime |
PARM_WILD
| Code | Description | Enabled | Reported |
|---|---|---|---|
| PARM_WILD | Array parameter is wild | Runtime |
PARSE_ERROR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| PARSE_ERROR | Unidentified error | Compilation |
PARSE_WARNING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| PARSE_WARNING | Variable declared but never used | Compilation |
READ_BAD_INDEX
| Code | Description | Enabled | Reported |
|---|---|---|---|
| READ_BAD_INDEX | Reading array out of range | Runtime |
READ_DANGLING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| READ_DANGLING | Reading from a dangling pointer | Runtime |
READ_NULL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| READ_NULL | Reading | Runtime |
READ_OVERFLOW
| Code | Description | Enabled | Reported |
|---|---|---|---|
| READ_OVERFLOW | Runtime | ||
| (normal) | Reading overflow's memory | Runtime | |
| (nonull) | String is not | Runtime | |
| (string) | Alleged string does not begin within legal range | Runtime | |
| (struct) | Structure reference out of range | Runtime |
READ_UNINIT_MEM
| Code | Description | Enabled | Reported |
|---|---|---|---|
| READ_UNINIT_MEM | Reading uninitialized memory | Runtime | |
| (copy) | Copy from uninitialized region | Runtime | |
| (read) | Use of uninitialized value | Runtime |
READ_UNINIT_PTR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| READ_UNINIT_PTR | Reading from uninitialized pointer | Runtime |
READ_WILD
| Code | Description | Enabled | Reported |
|---|---|---|---|
| READ_WILD | Reading wild pointer | Runtime |
RETURN_DANGLING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| RETURN_DANGLING | Returning pointer to local variable | Compilation |
RETURN_FAILURE
| Code | Description | Enabled | Reported |
|---|---|---|---|
| RETURN_FAILURE | Function call returned an error | Runtime |
RETURN_INCONSISTENT
| Code | Description | Enabled | Reported |
|---|---|---|---|
| RETURN_INCONSISTENT | Function has inconsistent return type | Compilation | |
| (level 1) | No declaration, returns nothing | Compilation | |
| (level 2) | Declared int, returns nothing | Compilation | |
| (level 3) | Declared non-int, returns nothing | Compilation | |
| (level 4) | Returns different types at different statements | Compilation |
STL_ERROR
Insure++ can detect several STL usage errors on Unix systems:
UNUSED_VAR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| UNUSED_VAR | Unused variables | Compilation | |
| (assigned) | Variable is assigned but never used | Compilation | |
| (unassigned) | Variable is never used | Compilation |
USER_ERROR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| USER_ERROR | User-generated error message | Runtime |
WRITE_BAD_INDEX
| Code | Description | Enabled | Reported |
|---|---|---|---|
| WRITE_BAD_INDEX | Writing array out of range | Runtime |
WRITE_DANGLING
| Code | Description | Enabled | Reported |
|---|---|---|---|
| WRITE_DANGLING | Writing to a dangling pointer | Runtime |
WRITE_NULL
| Code | Description | Enabled | Reported |
|---|---|---|---|
| WRITE_NULL | Writing to a NULL pointer | Runtime |
WRITE_OVERFLOW
| Code | Description | Enabled | Reported |
|---|---|---|---|
| WRITE_OVERFLOW | Runtime | ||
| (normal) | Writing overflows memory | Runtime | |
| (struct) | Structure references out of range | Runtime |
WRITE_UNINIT_PTR
| Code | Description | Enabled | Reported |
|---|---|---|---|
| WRITE_UNINIT_PTR | Writing to an uninitialized pointer | Runtime |
WRITE_WILD
| Code | Description | Enabled | Reported |
|---|---|---|---|
| WRITE_WILD | Writing to a wild pointer | Runtime |