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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [torture/] [pr37716.C] - Rev 693

Compare with Previous | Blame | View Log

// PR tree-optimization/37716
// { dg-do compile }

struct A
{
  struct B
  {
    int a, b, c, d;
    void *e[1];
  };
  B *d;
  inline void **f1 (int i) const
  {
    return d->e + d->c + i;
  }
};

template <typename T>
struct C
{
  struct D
  {
    void *v;
    inline T & f3 ()
    {
      return *reinterpret_cast <T *> (this);
    }
  };
  union
  {
    A p;
    A::B *d;
  };
  T & operator[](int i)
  {
    if (d->a != 1)
      f2 ();
    return reinterpret_cast <D *> (p.f1 (i))->f3 ();
  }
  void f2 ();
  void f3 (int i, const T & t);
};

class E
{
  int e, f;
};

C <E> c;

void
foo (int x)
{
  E e = c[x];
  c.f3 (x, e);
}

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.