[PATCH] D24238: StaticAnalyzer CastToStruct : No memory corruption when casting array to struct

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 9 12:34:15 PDT 2016

NoQ added a subscriber: cfe-commits.
NoQ added a comment.

Adding cfe-commits as per developer policy.

Yeah, it doesn't probably cause the same kind of memory corruption, however i wouldn't call this code safe: it still violates the //strict aliasing rule//, unless the array is of `char`s. I think this warning is worth keeping for non-`char` arrays. Even with `-fno-strict-aliasing` of some sort, the programmer might run into endianness or alignment issues.


More information about the cfe-commits mailing list