[PATCH] D23657: Remove some false positives when taking the address of packed members

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 15:00:06 PDT 2016


rsmith added inline comments.


================
Comment at: lib/Sema/SemaChecking.cpp:11356-11357
+  // Compute the EffectiveAlignment as the alignment of the whole chain.
+  CharUnits EffectiveAlignment = Context.getTypeAlignInChars(
+      ReverseMemberChain.back()->getParent()->getTypeForDecl());
+
----------------
In order to fix Joerg's latest false positives, you need to look at the type of the base expression itself rather than the class type containing the innermost member. (The base expression's type might provide more alignment than the struct being accessed guarantees.)


https://reviews.llvm.org/D23657





More information about the cfe-commits mailing list