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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [opt/] [preinc1.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// PR optimization/6086
2
// { dg-do run }
3
// { dg-options "-O" }
4
 
5
extern "C" void abort (void);
6
 
7
struct A
8
{
9
  A (int x, int y);
10
  int a, b;
11
  int foo () { return a; }
12
  int bar () { return b; }
13
};
14
 
15
struct B
16
{
17
  virtual ~B ();
18
  virtual A baz () const;
19
};
20
 
21
struct C
22
{
23
  A foo () const;
24
  B *c;
25
};
26
 
27
A C::foo () const
28
{
29
  int x, y;
30
  x = c->baz ().foo ();
31
  y = c->baz ().bar ();
32
  return A (x, y);
33
}
34
 
35
A B::baz () const
36
{
37
  return A (4, 8);
38
}
39
 
40
A::A (int x, int y)
41
{
42
  a = x;
43
  b = y;
44
}
45
 
46
B::~B ()
47
{
48
}
49
 
50
int
51
main ()
52
{
53
  C the_c;
54
  B the_b;
55
  the_c.c = &the_b;
56
  if (the_c.foo().a != 4)
57
    abort ();
58
  return 0;
59
}

powered by: WebSVN 2.1.0

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