summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr37421.C
blob: 4b8447eac499c208e006fa5a15305ccd5a888db8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* { dg-do compile } */

#include <stdio.h>
#include <string.h>

inline int
bci (const float &source)
{
 int dest;
 memcpy (&dest, &source, sizeof (dest));
 return dest;
}

inline float
bcf (const int &source)
{
 float dest;
 memcpy (&dest, &source, sizeof (dest));
 return dest;
}

float
Foo ()
{
 const int foo = bci (0.0f);
 int bar = foo;
 const int baz = foo & 1;
 if (!baz && (foo & 2))
   bar = 0;
 return bcf (bar);
}

int
main ()
{
  printf ("Foo() = %f\n", Foo());
  return 0;
}