Re: git master: compiler warnings
Roy Marples
Tue Oct 03 23:07:59 2017
Hi Maddes
On 03/10/2017 22:40, M. Buecher wrote:
I compiled the current git master on Raspbian/Debian 9.1 and got some
compiler warnings regarding signed/unsigned conversions.
Just wanted to inform you, so that these can get handled during the
ongoing development.
Build log from debuild is attached for your reference.
What cc version is this?
Kind regards
Maddes
a) src/common.c
common.c: In function ‘recvmsg_realloc’:
common.c:240:9: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
len = roundup(len, IOVEC_BUFSIZ);
Might be fixable.
^~~~~~~
b) src/if-linux.c
if-linux.c: In function ‘get_netlink’:
if-linux.c:374:13: warning: conversion to ‘__u32 {aka unsigned int}’
from ‘ssize_t {aka int}’ may change the sign of the result
[-Wsign-conversion]
nlm = NLMSG_NEXT(nlm, len))
^~~~~~~~~~
if-linux.c:374:13: warning: conversion to ‘ssize_t {aka int}’ from
‘__u32 {aka unsigned int}’ may change the sign of the result
[-Wsign-conversion]
if-linux.c: In function ‘add_attr_l’:
if-linux.c:864:40: warning: conversion to ‘__u32 {aka unsigned int}’
from ‘int’ may change the sign of the result [-Wsign-conversion]
((struct rtattr *)(((ptrdiff_t)(nmsg))+NLMSG_ALIGN((nmsg)->nlmsg_len)))
^
if-linux.c:878:8: note: in expansion of macro ‘NLMSG_TAIL’
rta = NLMSG_TAIL(n);
^~~~~~~~~~
if-linux.c: In function ‘add_attr_32’:
if-linux.c:864:40: warning: conversion to ‘__u32 {aka unsigned int}’
from ‘int’ may change the sign of the result [-Wsign-conversion]
((struct rtattr *)(((ptrdiff_t)(nmsg))+NLMSG_ALIGN((nmsg)->nlmsg_len)))
^
if-linux.c:900:8: note: in expansion of macro ‘NLMSG_TAIL’
rta = NLMSG_TAIL(n);
^~~~~~~~~~
if-linux.c: In function ‘nla_put_32’:
if-linux.c:964:8: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
len = NLA_ALIGN(NLA_HDRLEN + sizeof(data));
^~~~~~~~~
if-linux.c:964:8: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
if-linux.c:864:40: warning: conversion to ‘__u32 {aka unsigned int}’
from ‘int’ may change the sign of the result [-Wsign-conversion]
((struct rtattr *)(((ptrdiff_t)(nmsg))+NLMSG_ALIGN((nmsg)->nlmsg_len)))
^
if-linux.c:970:25: note: in expansion of macro ‘NLMSG_TAIL’
nla = (struct nlattr *)NLMSG_TAIL(n);
^~~~~~~~~~
if-linux.c:973:9: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
memcpy(NLA_DATA(nla), &data, sizeof(data));
^~~~~~~~
if-linux.c: In function ‘nla_put_string’:
if-linux.c:987:8: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
len = NLA_ALIGN(NLA_HDRLEN + sl);
^~~~~~~~~
if-linux.c:987:8: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
if-linux.c:864:40: warning: conversion to ‘__u32 {aka unsigned int}’
from ‘int’ may change the sign of the result [-Wsign-conversion]
((struct rtattr *)(((ptrdiff_t)(nmsg))+NLMSG_ALIGN((nmsg)->nlmsg_len)))
^
if-linux.c:993:25: note: in expansion of macro ‘NLMSG_TAIL’
nla = (struct nlattr *)NLMSG_TAIL(n);
^~~~~~~~~~
if-linux.c:996:9: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
memcpy(NLA_DATA(nla), data, sl);
^~~~~~~~
if-linux.c: In function ‘_gnl_getfamily’:
if-linux.c:1044:18: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
memcpy(&family, NLA_DATA(tb[CTRL_ATTR_FAMILY_ID]), sizeof(family));
^~~~~~~~
if-linux.c: In function ‘_if_getssid_nl80211’:
if-linux.c:1083:6: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
NLA_DATA(tb[NL80211_ATTR_BSS]),
^~~~~~~~
if-linux.c:1084:6: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
NLA_LEN(tb[NL80211_ATTR_BSS]),
^~~~~~~
if-linux.c:1091:18: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
memcpy(&status, NLA_DATA(bss[NL80211_BSS_STATUS]), sizeof(status));
^~~~~~~~
if-linux.c:1098:7: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
ie = NLA_DATA(bss[NL80211_BSS_INFORMATION_ELEMENTS]);
^~~~~~~~
if-linux.c:1099:16: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
ie_len = (int)NLA_LEN(bss[NL80211_BSS_INFORMATION_ELEMENTS]);
^~~~~~~
if-linux.c: In function ‘add_attr_nest’:
if-linux.c:864:40: warning: conversion to ‘__u32 {aka unsigned int}’
from ‘int’ may change the sign of the result [-Wsign-conversion]
((struct rtattr *)(((ptrdiff_t)(nmsg))+NLMSG_ALIGN((nmsg)->nlmsg_len)))
^
if-linux.c:1611:9: note: in expansion of macro ‘NLMSG_TAIL’
nest = NLMSG_TAIL(n);
^~~~~~~~~~
if-linux.c: In function ‘add_attr_nest_end’:
if-linux.c:864:40: warning: conversion to ‘__u32 {aka unsigned int}’
from ‘int’ may change the sign of the result [-Wsign-conversion]
((struct rtattr *)(((ptrdiff_t)(nmsg))+NLMSG_ALIGN((nmsg)->nlmsg_len)))
^
if-linux.c:1620:43: note: in expansion of macro ‘NLMSG_TAIL’
nest->rta_len = (unsigned short)((char *)NLMSG_TAIL(n) - (char *)nest);
Linux header issues.
^~~~~~~~~~
At top level:
if-linux.c:107:22: warning: ‘ipv4_bcast_addr’ defined but not used
[-Wunused-const-variable=]
static const uint8_t ipv4_bcast_addr[] = {
Can fix this
^~~~~~~~~~~~~~~
c) src/ipv4.c
ipv4.c: In function ‘inet_getroutes’:
ipv4.c:436:6: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
if (inet_routerhostroute(routes, ifp) == -1)
^
d) src/ipv6.c
ipv6.c: In function ‘inet6_getroutes’:
ipv6.c:2313:5: warning: assuming signed overflow does not occur when
simplifying conditional to constant [-Wstrict-overflow]
if (inet6_staticroutes(routes, ctx) == -1)
> ^
Compiler bug maybe?
I don't see how a signed overvlow can occur here.
e) src/ipv6nd.c
ipv6nd.c: In function ‘ipv6nd_open’:
ipv6nd.c:221:2: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
ICMP6_FILTER_SETPASS(ND_NEIGHBOR_ADVERT, &filt);
^~~~~~~~~~~~~~~~~~~~
ipv6nd.c:222:2: warning: negative integer implicitly converted to
unsigned type [-Wsign-conversion]
ICMP6_FILTER_SETPASS(ND_ROUTER_ADVERT, &filt);
^~~~~~~~~~~~~~~~~~~~
Linux header issue.
f) src/dhcp6.c
dhcp6.c: In function ‘dhcp6_bind’:
dhcp6.c:2948:21: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
if (state->renew > diff.tv_sec)
^
dhcp6.c:2954:22: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
if (state->rebind > diff.tv_sec)
^
dhcp6.c:2960:22: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
if (state->expire > diff.tv_sec)
Can probably fix this.
^
g) compat/crypt/md5.c/.h
In file included from ../compat/crypt/md5.c:23:0:
../compat/crypt/md5.c: In function ‘MD5Final’:
../compat/crypt/md5.h:22:26: warning: conversion to ‘size_t {aka
unsigned int}’ from ‘uint64_t {aka long long unsigned int}’ may alter
its value [-Wconversion]
#define MD5_BLOCK_LENGTH 64
^
../compat/crypt/md5.c:228:11: note: in expansion of macro
‘MD5_BLOCK_LENGTH’
padlen = MD5_BLOCK_LENGTH -
^~~~~~~~~~~~~~~~
Can probably fix this.
Really need compiler version used here.
Roy
Archive administrator: postmaster@marples.name