summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/torture/pr42834.c
blob: a1ba49e46d47cc24d8ce66e29fce3e3765dadeca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do run } */

void __attribute__((noinline,noclone))
foo(int *p, float *q) { __asm__ volatile ("" : : : "memory"); }

int main()
{
  if (sizeof (int) == sizeof (float))
    {
      int i;
      float f;
      int *p;
      /* Prevent i and f from being rewritten into SSA form.  */
      foo (&i, &f);
      i = 0;
      f = 1.0;
      p = (int *)&f;
      __builtin_memcpy (&i, p, 4);
      if (*(float *)&i != 1.0)
	__builtin_abort ();
    }
  return 0;
}