From 48d0598888622bd27e7debdf71c40807f6c8f6a3 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 17 Apr 2025 01:19:24 -0300 Subject: [PATCH] ada: use pointer decay for socket address type compatibility GCC 14 is stricter about type conversions. Taking the address of an array and decaying the array to a pointer to its first element yield the same address, but the types are no longer considered compatible. The socket data structures want decayed pointers rather than addresses of arrays, so drop the '&'s. gcc/ada/ChangeLog: * socket.c [__vxworks] (__gnat_gethostbyname): Drop excess '&'. (__gnat_gethostbyaddr): Likewise. --- gcc/ada/socket.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c index 77bdde40a24..a22ed993862 100644 --- a/gcc/ada/socket.c +++ b/gcc/ada/socket.c @@ -280,10 +280,10 @@ __gnat_gethostbyname (const char *name, return -1; } ret->h_name = name; - ret->h_aliases = &vxw_h_aliases; + ret->h_aliases = vxw_h_aliases; ret->h_addrtype = AF_INET; ret->h_length = 4; - ret->h_addr_list = &vxw_h_addr_list; + ret->h_addr_list = vxw_h_addr_list; return 0; } @@ -302,18 +302,18 @@ __gnat_gethostbyaddr (const char *addr, int len, int type, return -1; } - if (hostGetByAddr (*(int*)addr, &vxw_h_name) != OK) { + if (hostGetByAddr (*(int*)addr, vxw_h_name) != OK) { *h_errnop = __gnat_get_h_errno (); return -1; } vxw_h_addr = (long) addr; - ret->h_name = &vxw_h_name; - ret->h_aliases = &vxw_h_aliases; + ret->h_name = vxw_h_name; + ret->h_aliases = vxw_h_aliases; ret->h_addrtype = AF_INET; ret->h_length = 4; - ret->h_addr_list = &vxw_h_addr_list; + ret->h_addr_list = vxw_h_addr_list; return 0; } -- 2.47.2