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

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 10:08:03 PDT 2019


leonardchan added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I think I found a false negative with this where if the member is accessed from a packed struct type returned from a function, the warning does not appear:

  typedef struct {
    uint8_t a;
    uint32_t b; 
  } __attribute__((packed)) registers_t;
  
  registers_t *Class::method() { return registers_; }
  
  void Class::func() {
    other_func(&method()->b);  // I think the warning should appear here?
  }


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D20561/new/

https://reviews.llvm.org/D20561





More information about the cfe-commits mailing list