rsmith added a comment.
I agree, that looks like correct behavior for the warning. Thanks!
================
Comment at: lib/Sema/SemaCast.cpp:259-260
@@ -258,2 +258,4 @@
return ExprError();
+ if (DestType->isVoidPointerType())
+ DiscardMisalignedMemberAddress(E);
}
----------------
More generally, I think we should discard it if the destination of the cast is
a suitably-aligned pointer type. (For instance, casting to char* should be OK,
and casting an __attribute__((packed,aligned(2))) to a 2-byte-aligned pointer
type should be OK.)
http://reviews.llvm.org/D20561
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits