rsmith added inline comments.

================
Comment at: lib/Sema/SemaChecking.cpp:11054
@@ +11053,3 @@
+      auto AlignRecord = Context.getTypeAlignInChars(BaseType);
+      if ((RequiredAlignment > AlignRecord) ||
+          ((Context.toCharUnitsFromBits(
----------------
Suppose I have this:

  struct A { char c; int n; };
  struct __attribute__((packed)) B { A a; } b;
  char *p = &b.a.c;

Here, on the second iteration through this loop, it looks like you'll compute 
`RequiredAlignment == 4` (from `A`'s alignment of 4), with `AlignRecord == 1` 
(from the attribute), which would result in calling `Action`. This seems 
unnecessary, since we know we'll never diagnose this case, because the actual 
alignment of the field is (at least) the alignment of the original member `c`.


https://reviews.llvm.org/D23657



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to