Skip to content
Snippets Groups Projects
  • Roger Ferrer Ibanez's avatar
    e3a1336f
    Warn when taking address of a packed member · e3a1336f
    Roger Ferrer Ibanez authored
    This patch implements PR#22821.
    
    Taking the address of a packed member is dangerous since the reduced
    alignment of the pointee is lost. This can lead to memory alignment
    faults in some architectures if the pointer value is dereferenced.
    
    This change adds a new warning to clang emitted when taking the address
    of a packed member. A packed member is either a field/data member
    declared as attribute((packed)) or belonging to a struct/class
    declared as such. The associated flag is -Waddress-of-packed-member
    
    Differential Revision: http://reviews.llvm.org/D20561
    
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272552 91177308-0d34-0410-b5e6-96231b3b80d8
    e3a1336f
    History
    Warn when taking address of a packed member
    Roger Ferrer Ibanez authored
    This patch implements PR#22821.
    
    Taking the address of a packed member is dangerous since the reduced
    alignment of the pointee is lost. This can lead to memory alignment
    faults in some architectures if the pointer value is dereferenced.
    
    This change adds a new warning to clang emitted when taking the address
    of a packed member. A packed member is either a field/data member
    declared as attribute((packed)) or belonging to a struct/class
    declared as such. The associated flag is -Waddress-of-packed-member
    
    Differential Revision: http://reviews.llvm.org/D20561
    
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272552 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.