Debian Codegraph @

gcc/testsuite/g++.dg/lto/20080908-1_0.C

raw
1 /* { dg-lto-do run } */
2 extern "C" { extern void *memcpy (void *, const void *, __SIZE_TYPE__); }
3
4 typedef int int32_t __attribute__((mode (__SI__)));
5
6 inline int32_t
7 bci (const float &source)
8 {
9 int32_t dest;
10 memcpy (&dest, &source, sizeof (dest));
11 return dest;
12 }
13
14 inline float
15 bcf (const int32_t &source)
16 {
17 float dest;
18 memcpy (&dest, &source, sizeof (dest));
19 return dest;
20 }
21
22 float
23 Foo ()
24 {
25 const int32_t foo = bci (0.0f);
26 int32_t bar = foo;
27 const int32_t baz = foo & 1;
28 if (!baz && (foo & 2))
29 bar = 0;
30 return bcf (bar);
31 }
32
33 int main ()
34 {
35 if (sizeof (int32_t) == sizeof (float))
36 {
37 if (Foo () != 0.0)
38 return 1;
39 }
40 return 0;
41 }