Missing prototype and resulting coredump in 64 bit machines



Hi,
If i am not putting the function prototype of a function
returning a pointer, i get a core dump.Though this will happen less
probably on 32 bit machine

example
int main(int argc , char **argv)
{
char *base = basename(argv[0]) ;
printf("%s",base);
return 0;

}

The compiler assumes that basename is returning an int and thus we
loose 32 bit of the actual address, because pointer is 64 bit and
integer is 32 bit in 64 bit machines

I am working on
Os linux x86_64 2.6.9
Machine Hp
compiler gcc 3.46

Is there any option in GCC to make the default return value as long so
that i can preserve the actual address returned

Rakesh UV

.



Relevant Pages

  • Missing prototype and resulting coredump
    ... If i am not putting the function prototype of a function ... returning a pointer, i get a core dump.Though this will happen less ... The compiler assumes that basename is returning an int and thus we ... compiler gcc 3.46 ...
    (comp.lang.c)
  • Missing prototype and resulting coredump in 64 bit machines
    ... If i am not putting the function prototype of a function ... returning a pointer, i get a core dump.Though this will happen less ... The compiler assumes that basename is returning an int and thus we ... compiler gcc 3.46 ...
    (comp.os.linux.development.apps)
  • Missing prototype and resulting coredump in 64 bit machines
    ... If i am not putting the function prototype of a function ... returning a pointer, i get a core dump.Though this will happen less ... The compiler assumes that basename is returning an int and thus we ... compiler gcc 3.46 ...
    (comp.std.c)
  • Re: Missing prototype and resulting coredump in 64 bit machines
    ... returning a pointer, i get a core dump.Though this will happen less ... the result of malloc() to hide this type of warning]... ... that's one of the worst cases of "mangle a pointer into an int" ... compiler gcc 3.46 ...
    (comp.sys.hp.hpux)
  • Re: Missing prototype and resulting coredump in 64 bit machines
    ... returning a pointer, i get a core dump.Though this will happen less ... The compiler assumes that basename is returning an int and thus we ... compiler gcc 3.46 ...
    (comp.os.linux.development.apps)