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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ipa/] [devirt-c-6.C] - Blame information for rev 701

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

Line No. Rev Author Line
1 693 jeremybenn
/* Verify that ipa-cp correctly detects the dynamic type of an object
2
   under construction when doing devirtualization.  */
3
/* { dg-do run } */
4
/* { dg-options "-O3 -fno-inline"  } */
5
 
6
extern "C" void abort (void);
7
 
8
class A
9
{
10
public:
11
  int data;
12
  A();
13
  virtual int foo (int i);
14
};
15
 
16
class B : public A
17
{
18
public:
19
  virtual int foo (int i);
20
};
21
 
22
class C : public A
23
{
24
public:
25
  virtual int foo (int i);
26
};
27
 
28
int A::foo (int i)
29
{
30
  return i + 1;
31
}
32
 
33
int B::foo (int i)
34
{
35
  return i + 2;
36
}
37
 
38
int C::foo (int i)
39
{
40
  return i + 3;
41
}
42
 
43
static inline int __attribute__ ((always_inline))
44
middleman (class A *obj, int i)
45
{
46
  return obj->foo (i);
47
}
48
 
49
int __attribute__ ((noinline,noclone)) get_input(void)
50
{
51
  return 1;
52
}
53
 
54
__attribute__ ((noinline)) A::A ()
55
{
56
  if (middleman (this, get_input ()) != 2)
57
    abort ();
58
}
59
 
60
static void bah ()
61
{
62
  class B b;
63
}
64
 
65
int main (int argc, char *argv[])
66
{
67
  int i;
68
 
69
  for (i = 0; i < 10; i++)
70
    bah ();
71
  return 0;
72
}

powered by: WebSVN 2.1.0

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