This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/13836] Illegal instruction calling function pointer


------- Additional Comments From dje at watson dot ibm dot com  2004-01-26 18:57 -------
Subject: Re:  Illegal instruction calling function pointer 

	I cannot duplicate this error and I don't really understand the
explanation of GDB printing function descriptors.

	TOC and function descriptors are separate things.  The TOC
provides addressibility to global variables.

	Function pointers on AIX point to function descriptors, which are
a combination of function address and the TOC anchor for the module
containing the function.  A function pointer, like any other pointer, can
be stored in the TOC, but the function pointer does not point to a TOC
entry. 

	When I run the C++ application, compiled by gcc-3.3.2 on an AIX
5.1.0.0 system using the options listed in build_run.sh, I get the
following output:

200007f8
200007f8
In driver
In driver

If I examine the address 0x200007f8, I see

(gdb) x/2x 0x200007f8
0x200007f8 <__dbargs+532>:      0x100003f4      0x2000081c

which is the address of the function text and the address of the TOC
base.

	You might try running the AIX command slibclean, as root, to make
sure that you are not accidentally using an old shared library cached by
the system.

	An unreferenced static array does not affect the function
pointers.

	"pointer into the TOC" does not make any sense, so I do not know
what you really are trying to say.  A function pointer is a single address
of a function descriptor.  The compiler hides the two values (actually
three), but the programmer does not need to manipulate two values.

	Are you sure that the struct is not packed, breaking alignment
rules for pointers?

David


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13836


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]