This is the mail archive of the gcc@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]

Bug! when a function is the parameter of another function.



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

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