https://llvm.org/bugs/show_bug.cgi?id=22821
Roger Ferrer Ibanez <roger.ferreriba...@arm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from Roger Ferrer Ibanez <roger.ferreriba...@arm.com> --- clang does not accept #pragma pack but instead uses __attribute__((packed)). The example above could be rewritten as #include <stdio.h> typedef struct __attribute__((packed)) A { int v; } unaligned; void print(int *x) { printf("%d\n", *x); } void test1(unaligned *p) { print(&(p->v)); } void test2(unaligned *p) { int *x = &(p->v); printf("%d\n", *x); } As of https://reviews.llvm.org/rL278483 clang diagnoses this case clang -c prova.c -Wall prova.c:5:36: warning: taking address of packed member 'v' of class or structure 'A' may result in an unaligned pointer value [-Waddress-of-packed-member] void test1(unaligned *p) { print(&(p->v)); } ^~~~ prova.c:7:14: warning: taking address of packed member 'v' of class or structure 'A' may result in an unaligned pointer value [-Waddress-of-packed-member] int *x = &(p->v); ^~~~ 2 warnings generated. So I think we can consider this ticket as fixed -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs