[gcc r16-1798] ada: use pointer decay for socket address type compatibility
Marc Poulhies
dkm@gcc.gnu.org
Mon Jun 30 13:49:49 GMT 2025
https://gcc.gnu.org/g:48d0598888622bd27e7debdf71c40807f6c8f6a3
commit r16-1798-g48d0598888622bd27e7debdf71c40807f6c8f6a3
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Apr 17 01:19:24 2025 -0300
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.
Diff:
---
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 77bdde40a246..a22ed993862b 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;
}
More information about the Gcc-cvs
mailing list