2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / opt / cse2.C
blob325169dff348eb25f5994543b3ab50f171caddc1
1 // This testcase caused ICE on IA-32 in simplify_unary_operation
2 // CSE did not assume SUBREGs changing mode from integral to floating.
3 // { dg-do run { target i?86-*-* sparc*-*-* x86_64-*-* } }
4 // { dg-options "-O2" }
6 struct A
8   union
9     {
10       float f;
11       unsigned int w;
12     } a;
14   static inline const A foo (void)
15     {
16       return A ((unsigned int) (__extension__ ((union { unsigned l; float d; })
17                                                { l: 0x3f800000 }).d));
18     }
19   inline A (float f) { a.f = f; }
20   A ();
21   inline A (unsigned int w) { a.w = w; }
24 A::A()
26   *this = foo ();
29 A a;
31 extern "C" void abort (void);
32 extern "C" void exit (int);
34 int main ()
36   if (a.a.w != 1)
37     abort ();
38   exit (0);