OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [opt/] [alias1.C] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Test that type punning using an anonymous union works with strict aliasing.
2
// { dg-do run }
3
// { dg-options "-O2 -fstrict-aliasing" }
4
 
5
extern "C" void abort ();
6
 
7
void f (long i)
8
{
9
  union
10
  {
11
    long ui;
12
    float uf[20];
13
  };
14
 
15
  ui = i;
16
  if (uf[0] != 42.0)
17
    abort ();
18
}
19
 
20
int main ()
21
{
22
  union U { long i; float f[20]; } u;
23
  u.f[0] = 42.0;
24
  f (u.i);
25
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.