Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr37421.C

raw
1 /* { dg-do compile } */
2 /* { dg-require-effective-target int_eq_float } */
3
4 #include <stdio.h>
5 #include <string.h>
6
7 inline int
8 bci (const float &source)
9 {
10 int dest;
11 memcpy (&dest, &source, sizeof (dest));
12 return dest;
13 }
14
15 inline float
16 bcf (const int &source)
17 {
18 float dest;
19 memcpy (&dest, &source, sizeof (dest));
20 return dest;
21 }
22
23 float
24 Foo ()
25 {
26 const int foo = bci (0.0f);
27 int bar = foo;
28 const int baz = foo & 1;
29 if (!baz && (foo & 2))
30 bar = 0;
31 return bcf (bar);
32 }
33
34 int
35 main ()
36 {
37 printf ("Foo() = %f\n", Foo());
38 return 0;
39 }
40