1 /* { dg-do run } */
2 /* { dg-additional-options "-fstrict-aliasing" } */
3
4 extern void abort();
5
6 typedef int A;
7 typedef float B;
8
9 void __attribute__((noipa))
foo(A * p,B * r,long unk,long oh)10 foo(A * p, B *r, long unk, long oh)
11 {
12 for (long i = 0; i < unk; ++i) {
13 *p = 1;
14 *r = 2;
15 if (oh & i)
16 break;
17 *r = 3;
18 *p = 4;
19 }
20 }
21
main(void)22 int main(void)
23 {
24 union { A x; B f; } u;
25 foo(&u.x, &u.f, 1, 1);
26 if (u.x != 4) abort();
27 foo(&u.x, &u.f, 2, 1);
28 if (u.f != 2) abort ();
29 return 0;
30 }
31