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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 693 jeremybenn
// PR rtl-optimization/48549
2
// { dg-do compile }
3
// { dg-options "-fcompare-debug -O2" }
4
 
5
__extension__ typedef __PTRDIFF_TYPE__ pdiff_t;
6
 
7
void
8
foo (void *from, void *to)
9
{
10
  pdiff_t offset = reinterpret_cast (to)
11
                   - reinterpret_cast (from);
12
  if (offset != static_cast (offset))
13
    *(int *) 0xC0DE = 0;
14
  reinterpret_cast (from)[1] = offset;
15
}
16
struct A
17
{
18
  A () : a () {}
19
  A (void *x) : a (x) {}
20
  void *bar () { return a; }
21
  void *a;
22
};
23
struct C;
24
struct D;
25
struct E : public A
26
{
27
  C m1 (int);
28
  D m2 ();
29
  E () {}
30
  E (A x) : A (x) {}
31
};
32
struct C : public E
33
{
34
  C () {}
35
  C (void *x) : E (x) {}
36
};
37
struct D : public E
38
{
39
  D (void *x) : E (x) {}
40
};
41
C
42
E::m1 (int x)
43
{
44
  return (reinterpret_cast (bar ()) + x);
45
}
46
D
47
E::m2 ()
48
{
49
  return reinterpret_cast (bar ());
50
}
51
struct B
52
{
53
  E a;
54
  unsigned b : 16;
55
  unsigned c : 1;
56
};
57
void
58
baz (B *x)
59
{
60
  for (unsigned i = 0; i < 64; i++)
61
    {
62
      D d = x[i].a.m2 ();
63
      C c = x[i].a.m1 (x[i].c);
64
      foo (d.bar (), c.bar ());
65
    }
66
}

powered by: WebSVN 2.1.0

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