OSDN Git Service

2009-07-17 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / torture / pr37421.C
1 /* { dg-do compile } */
2
3 #include <stdio.h>
4 #include <string.h>
5
6 inline int
7 bci (const float &source)
8 {
9  int dest;
10  memcpy (&dest, &source, sizeof (dest));
11  return dest;
12 }
13
14 inline float
15 bcf (const int &source)
16 {
17  float dest;
18  memcpy (&dest, &source, sizeof (dest));
19  return dest;
20 }
21
22 float
23 Foo ()
24 {
25  const int foo = bci (0.0f);
26  int bar = foo;
27  const int baz = foo & 1;
28  if (!baz && (foo & 2))
29    bar = 0;
30  return bcf (bar);
31 }
32
33 int
34 main ()
35 {
36   printf ("Foo() = %f\n", Foo());
37   return 0;
38 }
39