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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [opt/] [alias1.C] - Rev 478

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

// Test that type punning using an anonymous union works with strict aliasing.
// { dg-do run }
// { dg-options "-O2 -fstrict-aliasing" }

extern "C" void abort ();

void f (long i)
{
  union
  {
    long ui;
    float uf[20];
  };

  ui = i;
  if (uf[0] != 42.0)
    abort ();
}

int main ()
{
  union U { long i; float f[20]; } u;
  u.f[0] = 42.0;
  f (u.i);
}

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

powered by: WebSVN 2.1.0

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