Bug! when a function is the parameter of another function.
Peng-Sheng Chen
pschen@puma.cs.nthu.edu.tw
Sun Mar 5 05:02:00 GMT 2000
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
More information about the Gcc
mailing list