IRIX64 6.5, gcc 2.95.1: weird inet_ntoa() behaviour

Mike Stump mrs@windriver.com
Wed May 24 12:05:00 GMT 2000


> Date: Wed, 24 May 2000 10:51:32 -0400 (EDT)
> From: Denis Vakatov <vakatov@peony.nlm.nih.gov>
> To: gcc@gcc.gnu.org
> CC: vakatov@peony.nlm.nih.gov, lavr@peony.nlm.nih.gov

First, you used the wrong list.  You seem to want to report a bug in
the compiler.  There is a list just for doing that that we created.
I'll copy the whole message there.

Second, you don't provide a complete testcase.  Certails the manual
and the webpages by now describe what a test case is.

I suspect the code in the headerfiles is not ANSI C code.  If that is
the case, we should probably fixincludes it.

> See the attached code:

> inet_ntoa() produces an invalid result when the following code
> compiled with GCC.
> However, it produces a correct result when compiled with native "cc".

> ?
> Denis Vakatov
> Anton Lavrentiev


> -----------------------------------------------------------------------------
> > uname -a
> IRIX64 muncher 6.5 10181058 IP27
> > gcc --version
> 2.95.1

> > cat - > inet_ntoa.c
> #include <net/if.h>
> #include <arpa/inet.h>
> #include <netinet/in.h>
> #include <stdio.h>

> int main(void)
> {
>   struct sockaddr_in sin;

>   sin.sin_family = AF_INET;
>   sin.sin_port = 0x1234;
>   sin.sin_addr.s_addr = 0x820E1923;

>   printf("%s\n", inet_ntoa(sin.sin_addr));
>   return 0;
> }


> > gcc inet_ntoa.c 
> > a.out
> 255.255.255.255


> > cc inet_ntoa.c 
> > a.out
> 130.14.25.35


More information about the Gcc-bugs mailing list