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



FUNC_BAD

Function pointer is not a function

This error is generated when an attempt is made to call a function through an invalid function pointer.

Problem

One simple way to generate this error is through the use of the union data type. If the union contains a function pointer which is invoked after initializing some other union member, this error can occur.

	1:	/*
	2:	 * File: funcbad.c
	3:	 */
	4:	union {
	5:		int *iptr;
	6:		int (*fptr)();
	7:	} u;
	8:
	9:	main()
	10:	{
	11:		int i;
	12:
	13:		u.iptr = &i;
	14:		u.fptr(); bug
	15:		return (0);
	16:	}

Diagnosis (at runtime)

	[funcbad.c:14] **FUNC_BAD**
1.	>> 		u.fptr();
	
2.		Function pointer is not a function: u.fptr
	
3.		Pointer	   : 0xf7fff8cc
		In block   : 0xf7fff8cc thru 0xf7fff8cf 
4.				(4 bytes,1 element)
				i, declared at funcbad.c, 11

		Stack trace where the error occurred:
5.				main() funcbad.c, 14

6.		**Memory corrupted. Program may crash!!**
  1. Source line at which the problem was detected.
  2. Description of the problem and the expression that is in error.
  3. The value of the pointer through which the call is being attempted.
  4. Description of the memory block to which this pointer actually points, including its size and the source line of its declaration.
  5. Stack trace showing the function call sequence leading to the error.
  6. Informational message indicating that a serious error has occurred which may cause the program to crash.

Repair

The description of the memory block to which the pointer points should enable you to identify the statement which was used to assign the function pointer incorrectly.


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