From: Douglas B Rupp <r...@adacore.com>

In the vxworks section, a conversion between char* and int is
attempted, which results in a warning with gcc. However with clang
with is an error. Note also on 64bit targets, there's a size
mismatch.

gcc/ada/ChangeLog:

        * socket.c [__vxworks]: Change vxw_h_addr type to long from
        int, and cast the conversion of char* to vxw_h_addr to avoid
        warning/error.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c
index 75b4288a129..297d303cef7 100644
--- a/gcc/ada/socket.c
+++ b/gcc/ada/socket.c
@@ -266,7 +266,7 @@ __gnat_getservbyport (int port, const char *proto,
 #elif defined (__vxworks)
 static char vxw_h_name[MAXHOSTNAMELEN + 1];
 static char *vxw_h_aliases[1] = { NULL };
-static int vxw_h_addr;
+static long vxw_h_addr;
 static char *vxw_h_addr_list[2] = { (char*) &vxw_h_addr, NULL };
 
 int
@@ -307,7 +307,7 @@ __gnat_gethostbyaddr (const char *addr, int len, int type,
     return -1;
   }
 
-  vxw_h_addr       = addr;
+  vxw_h_addr       = (long) addr;
 
   ret->h_name      = &vxw_h_name;
   ret->h_aliases   = &vxw_h_aliases;
-- 
2.43.0

Reply via email to