https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82283

--- Comment #5 from Yann Droneaud <yann at droneaud dot fr> ---
For a full combo, here's the almost original code that trigger the two errors
above with GLibc < 2.28, only one with newer Glibc.

    #define _GNU_SOURCE 1

    #include <arpa/inet.h>
    #include <netinet/in.h>
    #include <sys/socket.h>

    int test(int fd)
    {
            static const char message[] = "Hello world";

            struct sockaddr_in addr = {
                    .sin_family = AF_INET,
                    .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
                    .sin_port = htons(12345),
            };

            struct iovec vec = {
                    .iov_base = (void *)message,
                    .iov_len = sizeof(message),
            };

            struct mmsghdr mmsghdr = {
                    .msg_hdr = (struct msghdr) {
                            .msg_name = &addr,
                            .msg_namelen = sizeof(addr),
                            .msg_iov = &vec,
                            .msg_iovlen = 1,
                    },
            };

            return sendmmsg(fd, &mmsghdr, 1, 0);
    }

see https://godbolt.org/z/pwXyzE

Reply via email to