This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Bug! when a function is the parameter of another function.
- To: <gcc at gcc dot gnu dot org>, <gcc-bug at gcc dot gnu dot org>
- Subject: Bug! when a function is the parameter of another function.
- From: "Peng-Sheng Chen" <pschen at puma dot cs dot nthu dot edu dot tw>
- Date: Sun, 5 Mar 2000 21:05:51 +0800
Hello:
If I write a C program which include a function is the parameter of another function,
gcc will produce wrong assembly-code.
ex : test.c
void func1(void)
{
}
void func2(void *f)
{
}
int main(void)
{
func2(&func1);
return 1;
}
Use option -fpic to producePIC code, gcc produce follow :
......
move.l func1@GOT.w(%a5),%d0
......
func1 is a function pointer, not a data variable, it should produce follow :
move.l func1@PLTPC,%d0
I trace its RTL file, the RTL file can't recognize which is function and which is data variable.
Did GCC exist some function or macro which can test symbol_ref is a function or data variable?
Thanks very much.
Ps. Chen