On Fri, Aug 12, 2016 at 08:04:13AM -0000, Roger Ferrer Ibanez via cfe-commits wrote: > Author: rogfer01 > Date: Fri Aug 12 03:04:13 2016 > New Revision: 278483 > > URL: http://llvm.org/viewvc/llvm-project?rev=278483&view=rev > Log: > This patch implements PR#22821. > > Taking the address of a packed member is dangerous since the reduced > alignment of the pointee is lost. This can lead to memory alignment > faults in some architectures if the pointer value is dereferenced.
This triggers on LVM in a rather obvious false positive: (uintptr_t) &lh->offset_xl Given that one correct use case is to take the address and cast it to void * (or uintptr_t) for use without caring about alignment, the warning clearly needs to be refined. I'm also missing a test case in this commit. Most importantly, it should test, whether it correctly handles the case of packed+align where align > alignof(field). Joerg _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits