Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / g++.dg / opt / alias1.C
blob4836c5be06ab565c7045e9c5b49dc93d9abf4561
1 // Test that type punning using an anonymous union works with strict aliasing.
2 // { dg-do run }
3 // { dg-options "-O2 -fstrict-aliasing" }
5 extern "C" void abort ();
7 void f (long i)
9   union
10   {
11     long ui;
12     float uf[20];
13   };
15   ui = i;
16   if (uf[0] != 42.0)
17     abort ();
20 int main ()
22   union U { long i; float f[20]; } u;
23   u.f[0] = 42.0;
24   f (u.i);