OSDN Git Service

PR c++/44157
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / cse2.C
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" }
5
6 struct A
7 {
8   union
9     {
10       float f;
11       unsigned int w;
12     } a;
13
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; }
22 };
23
24 A::A()
25 {
26   *this = foo ();
27 }
28
29 A a;
30
31 extern "C" void abort (void);
32 extern "C" void exit (int);
33
34 int main ()
35 {
36   if (a.a.w != 1)
37     abort ();
38   exit (0);
39 }