This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

IRIX64 6.5, gcc 2.95.1: weird inet_ntoa() behaviour


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]