ClangBuiltLinux / linux

Linux kernel source tree
Other
241 stars 14 forks source link

-Wdivision-by-zero in include/linux/poll.h #1382

Open nickdesaulniers opened 3 years ago

nickdesaulniers commented 3 years ago

working around #1380 , I do see the next warning to figure out:

In file included from net/ipv6/ila/ila_lwt.c:10:
In file included from ./include/net/dst_cache.h:8:
In file included from ./include/net/ip6_fib.h:18:
In file included from ./include/net/ip_fib.h:20:
In file included from ./include/net/inetpeer.h:16:
In file included from ./include/net/ipv6.h:12:
In file included from ./include/linux/ipv6.h:88:
In file included from ./include/linux/tcp.h:19:
In file included from ./include/net/sock.h:61:
./include/linux/poll.h:142:27: warning: division by zero is undefined [-Wdivision-by-zero]
                M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
                                        ^~~~~~~~~
./include/linux/poll.h:140:32: note: expanded from macro 'M'
#define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/poll.h:126:51: note: expanded from macro '__MAP'
        (from < to ? (v & from) * (to/from) : (v & from) / (from/to))
                                                         ^ ~~~~~~~~~
./include/linux/poll.h:142:39: warning: division by zero is undefined [-Wdivision-by-zero]
                M(RDNORM) | M(RDBAND) | M(WRNORM) | M(WRBAND) |
                                                    ^~~~~~~~~
./include/linux/poll.h:140:32: note: expanded from macro 'M'
#define M(X) (__force __poll_t)__MAP(val, POLL##X, (__force __u16)EPOLL##X)
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/poll.h:126:51: note: expanded from macro '__MAP'
        (from < to ? (v & from) * (to/from) : (v & from) / (from/to))
                                                         ^ ~~~~~~~~~
JustinStitt commented 11 months ago

When trying to reproduce this issue I am running into some other issues with recent clang versions and the m68k kernel target. See #1945.

Going to leave this issue as untriaged.