1 2 3 4 5 6 7 8 9 10 11 12
// { dg-do compile } // { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" } struct s { char *p; }; void func(struct s *ptr) { *(void **)&ptr->p = 0; /* { dg-warning "type-punned pointer" } */ }