[PATCH] D20561: Warn when taking address of packed member

Roger Ferrer Ibanez via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 09:32:47 PDT 2016


rogfer01 added a comment.

I think I wasn't clear with the purpose of the fix-it: there are a few cases where getting the address of an unaligned pointer is safe (i.e. false positives).

For instance, when I checked Firefox and Chromium there are cases where getting the address of an unaligned pointer is fine. For the particular case of these two browsers, they both use a library (usrsctp) that represents protocol data as packed structs. That library passes addresses of packed fields to `memcpy` and `memmove` which is OK.

The fix-it can help silencing the warning for those cases once deemed safe. This is the reason why I keep comparing the new warning to the assignment-vs-comparison warning: there may not be an error, just extra syntax (parentheses) can be used to silence the warning.


http://reviews.llvm.org/D20561





More information about the cfe-commits mailing list