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]

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


>     Assume in m68k platform :
>     My question is that if I want to produce a position-independent-code,
>     the data is based on some register (ex:A5), function label is based on PC.
>     GCC produce PIC code that data and function label referenced are based on A5.
>     It can't reference correct postion for function that is the parameter of another function in PIC.

Thanks for your bug report. Please have a look at

http://www.gnu.org/software/gcc/bugs.html

and try to make a *COMPLETE* bug report. I.e. give us some source
code, say what operating system you are using, show us the assembler
code, say what happens when you run the program, and why you think
this is incorrect.

For example, consider the program

#include <stdio.h>

void foo(){
  printf("Here\n");
}

void bar(void (*f)()){
  f();
}

int main()
{
  bar(foo);
}

When run, it should print 'Here'. What happens when you compile this
program on your system? What if you use -fPIC instead of -fpic?

Please also have a look at

http://gcc.gnu.org/ml/gcc/1998-02/msg00977.html
http://gcc.gnu.org/ml/gcc/1998-02/msg01000.html
http://gcc.gnu.org/ml/gcc/1999-10n/msg00415.html
http://gcc.gnu.org/ml/gcc/1999-10n/msg00442.html

Regards,
Martin

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