summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wstrict-aliasing-struct-with-char-member.c
blob: 0da9a163781fda99510757e78b0b95150b9826af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */

struct a {
    int i;
    char c;
};
struct b {
    float f;
    float g;
};
int main(void)
{
  static struct b b;
  return ((struct a *)&b)->i; /* { dg-warning "will break strict-aliasing" } */
}