Search

ParaSoft

HOME
PRODUCTS
SUPPORT
ABOUT
WHAT'S NEW
EVENTS


Insure++

Quick facts

Add-on Modules:
   -INUSE
   -TCA

Comparisons

Technical Papers

Support & Manuals

FAQs

Recent Reviews

User Testimonials

Press Releases


Insure tool to debug c++





Insure++ Reference - EXPR_UNINIT_PTR



EXPR_UNINIT_PTR

Expression uses uninitialized pointer

This error is generated whenever an expression operates on an uninitialized pointer.

Problem

The following code uses an uninitialized pointer.


	1:	/*
	2:	 * File: expuptr.c
	3:	 */
	4:	main()
	5:	{
	6:		char *a, b[10], c[10];
	7:
	8:		if(a > b) bug
	9:		     a = b;
	9:		return (0);
	10:	}

Diagnosis (at runtime)


1.	[expuptr.c:8] **EXPR_UNINIT_PTR**
	>> 		if (a > b)
	
2.		Expression uses uninitialized pointer: a > b

3.		Stack trace where the error occurred:
			main() expuptr.c, 8


  1. Source line at which the problem was detected.
  2. Description of the problem and the expression that is in error.
  3. Stack trace showing the function call sequence leading to the error.

Repair

This error is normally caused by omitting an assignment statement for the uninitialized variable. The example code can be corrected as follows:


	1:	/*
	2:	 * File: expuptr.c (modified)
	3:	 */
	4:	main()
	5:	{
	6:		char *a, b[10], c[10];
	7:
	8:		a = c;
	9:		if(a > b)
	10:		      a = b;
	11:		return (0);
	12:	}

< EXPR_NULL > EXPR_UNRELATED_PTRCMP
Tools to debug c++ and java
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft