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

global variabÂle and global function naÂmes are the same - result is segfault


Hi all,
Is there any "magic" gcc option which would prevent linker successfully link the following program:
------------------------ file test1.c ---------------------------
int foo;
------------------------ file test2.c ---------------------------
int  foo(int a);
int main (int argc, char argv[]){   foo(0);   return 0;}
Compilation and linking with gcc test1.c test2.c -o test
and run./test
gives segmentation fault on my Ubuntu x86 machine.
What I see is that the linker successfully links foo global variable as a global function, which is a nonsense to me.Please advice.
Thank you,--Adel


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