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

Roger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 05:29:10 PST 2017


royger added a comment.

In https://reviews.llvm.org/D20561#663069, @joerg wrote:

> @royger: Your example is missing explicit alignment. packed has two side effects: remove internal padding and set the alignment to 1. That means that the offset of base doesn't matter so much because reg itself is not necessarily aligned.


Does this means that it's "working as intended" then? I could expect this to complain when doing something like:

  struct __attribute__((__packed__)) bar {
      uint64_t x1;
      uint16_t x2;
      uint64_t x3;
  };
  
  &bar->x3;

But not in the previous case.


Repository:
  rL LLVM

https://reviews.llvm.org/D20561





More information about the cfe-commits mailing list