Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space INSDEVEL and version 7.5.4

In this section:

Table of Contents
maxLevel1
minLevel1

Overview

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

Excerpt

Scroll Table Layout
sortDirectionASC
repeatTableHeadersdefault
widths10%,60%,10%,10%,10%
sortByColumn1
sortEnabledfalse
cellHighlightingtrue

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.

Code Block
languagecpp
themeEclipse
linenumberstrue
/*
 * File: funcbad.c
 */
union {
	int *iptr;
	int (*fptr)();
} u;

main()
{
	int i;

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

Diagnosis at Runtime

Code Block
languagetext
linenumberstrue
[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!!**
  • Line 2: Source line at which the problem was detected.
  • Line 3: Description of the problem and the expression that is in error.
  • Line 4: The value of the pointer through which the call is being attempted.
  • Line 6: Description of the memory block to which this pointer actually points, including its size and the source line of its declaration.
  • Line 9: Stack trace showing the function call sequence leading to the error.
  • Line 10: 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.