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

Joerg Sonnenberger via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 06:52:13 PDT 2016


joerg added a comment.

A simple case that still seems to fail:

  #include <inttypes.h>
  
  struct foo {
    uint32_t x;
    uint8_t y[2];
    uint16_t z;
  } __attribute__((__packed__));
  
  typedef struct foo __attribute__((__aligned__(16))) aligned_foo;
  
  int main(void) {
    struct foo x;
    struct foo __attribute__((__aligned__(4))) y;
    aligned_foo z;
  
    uint32_t *p32;
    p32 = &x.x;
    p32 = &y.x;
    p32 = &z.x;
  }

Only the first assignment to p32 should warn, the others are all correctly aligned.


https://reviews.llvm.org/D23657





More information about the cfe-commits mailing list