This bug is found by gentoo ci: https://bugs.gentoo.org/937325
This happens on gcc-14 because it catches this type of error,
"-Wincompatible-pointer-types".
This doesn't happen on glibc but on musl because the type
declaration of connect/bind is a bit different.
The error message is bellow and the patch is in attachment.
- Qian
x86_64-pc-linux-musl-gcc -Ino/include -g -fPIC -Lno/lib -shared gmp_wrap.c \
-lgmp -o
/var/tmp/portage/sci-mathematics/fricas-1.3.11-r2/work/fricas-1.3.11/target/x86_64-pc-linux-musl/lib/gmp_wrap.so
sockio-c.c: In function 'connect_to_local_server':
sockio-c.c:761:34: error: passing argument 2 of 'connect' from
incompatible pointer type
[-Wincompatible-pointer-types[https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Warning-Options.html#index-Wincompatible-pointer-types]]
761 | code = connect(sock->socket, uaddr, sizeof(*uaddr));
| ^~~~~
| |
| struct sockaddr_un *
In file included from
/var/tmp/portage/sci-mathematics/fricas-1.3.11-r2/work/fricas-1.3.11/src/include/com.h:42,
from sockio-c.c:48:
/usr/include/sys/socket.h:386:19: note: expected 'const struct sockaddr
*' but argument is of type 'struct sockaddr_un *'
386 | int connect (int, const struct sockaddr *, socklen_t);
| ^~~~~~~~~~~~~~~~~~~~~~~
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/715785ed-4ef0-4e2e-bf17-31bee3ebbef2%40gmail.com.
diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c
index e89163ce..8628bdc9 100644
--- a/src/lib/sockio-c.c
+++ b/src/lib/sockio-c.c
@@ -758,7 +758,7 @@ connect_to_local_server(char *server_name, int purpose, int time_out)
uaddr->sun_family = FRICAS_AF_LOCAL;
strncpy(uaddr->sun_path, name, sizeof(uaddr->sun_path) - 1);
for(i=0; i<max_con; i++) {
- code = connect(sock->socket, uaddr, sizeof(*uaddr));
+ code = connect(sock->socket, (struct sockaddr *)uaddr, sizeof(*uaddr));
if (code == -1) {
if (
/* @@@ Why we need this */
@@ -932,7 +932,7 @@ open_server(char *server_name)
struct sockaddr_un * uaddr = &(sock->addr.u_addr);
uaddr->sun_family = FRICAS_AF_LOCAL;
strncpy(uaddr->sun_path, name, sizeof(uaddr->sun_path) - 1);
- if (bind(sock->socket, uaddr, sizeof(*uaddr))) {
+ if (bind(sock->socket, (struct sockaddr *)uaddr, sizeof(*uaddr))) {
perror("binding local server socket");
server[1].socket = 0;
return -2;