OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [opt/] [cse2.C] - Rev 154

Compare with Previous | Blame | View Log

// This testcase caused ICE on IA-32 in simplify_unary_operation
// CSE did not assume SUBREGs changing mode from integral to floating.
// { dg-do run { target i?86-*-* sparc*-*-* x86_64-*-* } }
// { dg-options "-O2" }

struct A
{
  union
    {
      float f;
      unsigned int w;
    } a;

  static inline const A foo (void)
    {
      return A ((unsigned int) (__extension__ ((union { unsigned l; float d; })
                                               { l: 0x3f800000 }).d));
    }
  inline A (float f) { a.f = f; }
  A ();
  inline A (unsigned int w) { a.w = w; }
};

A::A()
{
  *this = foo ();
}

A a;

extern "C" void abort (void);
extern "C" void exit (int);

int main ()
{
  if (a.a.w != 1)
    abort ();
  exit (0);
}

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.