On Mon, Aug 15, 2016 at 6:20 PM, Matthias Braun <ma...@braunis.de> wrote: > MatzeB added a subscriber: MatzeB. > MatzeB added a comment. > > The sanitizer code triggers this warning for code that looks conceptually > like this: > > typedef struct Bla { char bar; int foo; } __attribute__((packed)); > > uintptr_t getu(struct Bla *b) { return (uintptr_t)&b->foo; } > > Resulting in: > > taking address of packed member 'foo' of class or structure > 'Bla' may result in an unaligned pointer value > [-Waddress-of-packed-member] > > Of course the warning can be silenced with `return > (uintptr_t)(char*)&b->foo;` still casting to an int type seems like a benign > case for this warning so maybe we should exclude that?
I agree, it seems sensible to silence the warning in that case, yes. ~Aaron > > > Repository: > rL LLVM > > https://reviews.llvm.org/D20561 > > > _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits