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 - PARM_UNINIT_PTR



PARM_UNINIT_PTR

Array parameter is uninitialized pointer

This error is generated whenever an uninitialized pointer is passed as an argument to a function which expects an array parameter.

Problem

This code passes the uninitialized pointer a to routine foo.

	1:	/*
	2:	 * File: parmuptr.c
	3:	 */
	4:	char foo(a)
	5:		char a[10];
	6:	{
	7:		return a[0];
	8:	}
	9:
	10:	main()
	11:	{
	12:		char *a;
	13:
	14:		foo(a); bug
	15:		return (0);
	16:	}

Diagnosis (at runtime)

	[parmuptr.c:6] **PARM_UNINIT_PTR**
1.	>> 	{
	
2.		Array parameter is uninitialized pointer: a

		Stack trace where the error occurred:
3.			 	 foo() parmuptr.c, 6
				main() parmuptr.c, 14
  1. Source line at which the problem was detected.
  2. Description of the problem and the argument that is in error.
  3. Stack trace showing the function call sequence leading to the error.

Repair

This problem is usually caused by omitting an assignment or allocation statement that would initialize a pointer. The code given, for example, could be corrected by including an assignment as shown below.

	/*
	 * File: parmuptr.c (Modified)
	 */
	...
	main()
	{
	      char *a, b[10];
	      a = b;
	      foo(a);
	}

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