This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
RE: inet_ntoa on IRIX
- To: "'Boyan Gadjev'" <bgadjev at verio dot net>, gcc-bugs at gcc dot gnu dot org
- Subject: RE: inet_ntoa on IRIX
- From: "Billinghurst, David (CRTS)" <David dot Billinghurst at riotinto dot com>
- Date: Mon, 14 Aug 2000 23:18:42 -0000
From http://freeware.sgi.com/shared/howto.html
Code that runs fine when compiled withe SGI cc and doesn't run when compiled
with gcc is possibly using calls to one of the following:
inet_ntoa, (and some other inet_XXX), semctl
(there may be others). These are functions that get passed or return structs
that are smaller than 16-bit long and not 8-bits long. gcc and SGI cc are
incompatible in the way they pass these structs so compiling with gcc and
linking with the SGI libc.so (which was compiled with the SGI cc) is likely
to cause these problems. Note that this problem is pretty rare since such
functions are not widely used. This may be considered a bug in gcc but is
too involved to fix I'm told.
> -----Original Message-----
> From: Boyan Gadjev [SMTP:bgadjev@verio.net]
> Sent: Tuesday, 15 August 2000 0:04
> To: gcc-bugs@gcc.gnu.org
> Subject: inet_ntoa on IRIX
>
> o200 with IRIX 6.5.8m and gcc version 2.95.2 19991024 (release)
> AND
> o200 with IRIX 6.5.4m and gcc version 2.95 19990728 (release)
>
> the source code :
> #include <unistd.h>
> #include <netinet/in.h>
> #include <sys/socket.h>
> #include <sys/types.h>
> #include <netdb.h>
> #include <errno.h>
>
> int main() {
> struct sockaddr_in server;
> char *name;
>
> inet_aton("64.34.103.9", (struct in_addr *)&server.sin_addr);
> name = (char *) inet_ntoa(server.sin_addr);
> printf("%s\n", name);
> }
>
> compiled with gcc :
> root@xxxxxxx ~ # gcc -o t testgcc.c
> root@xxxxxxx ~ # ./t
> 0.0.0.0
> (wrong!!!)
>
> compiled with the sgi's cc :
> root@xxxxxxx ~ # cc -o t testgcc.c
> root@xxxxxxx ~ # ./t
> 64.34.103.9
> (this is the correct one right ? and I have the same result on linux or
> openbsd)
>
> Sorry if I'm writing about a known problem, but I couldn't find anything
> about this. I am not a big C specialist :)
>
> --
>
> Boyan Gadjev
> UNIX Systems Administrator
> VERIO Inc.
> 877-272-2418 x.4337
>