In this section:

Overview

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

CodeDescriptionEnabledReportedPlatform
FUNC_BAD

Function pointer is not a function

(tick)RuntimeWindows/Unix


Problem

A 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.

/*
 * File: funcbad.c
 */
union {
	int *iptr;
	int (*fptr)();
} u;

main()
{
	int i;

	u.iptr = &i;
	u.fptr();
	return (0);
}

Diagnosis at Runtime

[funcbad.c:14] **FUNC_BAD**
>>		 u.fptr();
Function pointer is not a function: u.fptr
Pointer		 : 0xf7fff8cc
In block	 : 0xf7fff8cc thru 0xf7fff8cf
				(4 bytes,1 element)
				i, declared at funcbad.c, 11
Stack trace where the error occurred:
		main() funcbad.c, 14
		**Memory corrupted. Program may 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.