This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: IRIX64 6.5, gcc 2.95.1: weird inet_ntoa() behaviour
- To: vakatov at peony dot nlm dot nih dot gov (Denis Vakatov)
- Subject: Re: IRIX64 6.5, gcc 2.95.1: weird inet_ntoa() behaviour
- From: "Philippe De Muyter" <phdm at macqel dot be>
- Date: Thu, 25 May 2000 09:04:19 +0200 (CEST)
- Cc: gcc at gcc dot gnu dot org, vakatov at peony dot nlm dot nih dot gov, lavr at peony dot nlm dot nih dot gov
Denis Vakatov wrote :
> Hi,
>
> 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
>
I think you check the way small structs are passed as function arguments
in gcc versus cc. Probably does one compiler pass them in a register an the
other on the stack.
Philippe