victor@MIZAR.DOCS.UU.SE (Bjorn Victor) (11/13/89)
Environment:
Sun 4/260 running SunOS 4.0.1
"gcc version 1.36"
"GNU CPP version 1.36"
"GNU C version 1.36 (sparc) compiled by CC."
"Gnu assembler version 1.34 (I guess.)"
(unknown version of GNU loader)
Give the following program (an extract from the original):
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
main(argc,argv)
int argc;
char *argv[];
{
struct in_addr naddr;
int net;
char *string;
net = atoi(argv[1]);
naddr = inet_makeaddr(net,0);
printf("Net = %d, Netaddr = %lu\n",net,naddr.s_addr);
string = inet_ntoa(&naddr);
printf("Or rather: %s\n", string);
}
When compiled with Sun's /bin/cc, the program runs OK (net = 10 gives
naddr.s_addr = 167772160).
When compiled with gcc, the call to inet_makeaddr() always returns 0,
which is incorrect. Using the -fpcc-struct-return option doesn't make
it work.
With gcc version 1.35 on a Sun 3/60 running the same OS, the program works.
If I compile the BSD4.3 definition of inet_makeaddr with gcc, the
combination works, but I can't recompile the system with gcc...
Please aid me, since I'd really love to use gcc for all C code I write!
Yours,
-- Bjorn Victor victor@DoCS.UU.SE
Dept. of Computer Systems or victor%DoCS.UU.SE@uunet.UU.NET
Uppsala University, Sweden "I'd rather hack a Lisp Machine!"