On Mon, Oct 03, 2016 at 07:10:08AM +0000, Roger Ferrer Ibanez wrote: > Hi Joerg, > > thanks for your comments. I agree that these false positives are annoying. > > I submitted a while ago a patch to address those false positives in > https://reviews.llvm.org/D23657 but it is pending approval.
I'm trying this patch now. Two instances here show false positives. Some others are misuse/overuse of __packed, it is time consuming to check all of them. --- sbin/route https://nxr.netbsd.org/xref/src/sbin/route/route.c#1009 triggers the warning: union mpls_shim *ms = &su->smpls.smpls_addr; where su is defined as: union sockunion { ... struct sockaddr_mpls smpls; }; and sockaddr_mpls in turn is https://nxr.netbsd.org/xref/src/sys/netmpls/mpls.h#66 struct sockaddr_mpls { uint8_t smpls_len; uint8_t smpls_family; uint8_t smpls_pad[2]; union mpls_shim smpls_addr; } __packed; smpls_addr is a union of a uint32_t and matching bit field. The alignment of sockunion and the explicit padding ensures that all fields can be accessed correctly. --- sbin/ifconfig Member access is https://nxr.netbsd.org/xref/src/sbin/ifconfig/ieee80211.c#969 The macro is defined at https://nxr.netbsd.org/xref/src/sbin/ifconfig/ieee80211.c#928 Most importantly, this effective casts immediately to (unsigned) char and therefore doesn't care about any misalignment. Joerg _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits