comparison gcc/testsuite/gcc.dg/Wstrict-aliasing-struct-with-char-member.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wall" } */
3
4 struct a {
5 int i;
6 char c;
7 };
8 struct b {
9 float f;
10 float g;
11 };
12 int main(void)
13 {
14 static struct b b;
15 return ((struct a *)&b)->i; /* { dg-warning "will break strict-aliasing" } */
16 }