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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ipa/] [iinline-3.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* Verify that we do not indirect-inline using member pointer
2
   parameters which have been modified.  */
3
/* { dg-do run } */
4
/* { dg-options "-O3 -fno-early-inlining"  } */
5
/* { dg-add-options bind_pic_locally } */
6
 
7
extern "C" void abort (void);
8
 
9
class String
10
{
11
private:
12
  const char *data;
13
 
14
public:
15
  String (const char *d) : data(d)
16
  {}
17
 
18
  int funcOne (int stuff) const;
19
  int funcTwo (int stuff) const;
20
};
21
 
22
 
23
int String::funcOne (int stuff) const
24
{
25
  return stuff + 1;
26
}
27
 
28
int String::funcTwo (int stuff) const
29
{
30
  return stuff + 100;
31
}
32
 
33
int (String::* gmp)(int stuff) const = &String::funcTwo;
34
 
35
int docalling_1 (int (String::* f)(int stuff) const)
36
{
37
  String S ("muhehehe");
38
 
39
  return (S.*f)(4);
40
}
41
 
42
int docalling (int a, int (String::* f)(int stuff) const)
43
{
44
  if (a < 200)
45
    f = gmp;
46
 
47
  return docalling_1 (f);
48
}
49
 
50
int __attribute__ ((noinline,noclone)) get_input (void)
51
{
52
  return 1;
53
}
54
 
55
int main (int argc, char *argv[])
56
{
57
  int i = 0;
58
  while (i < 10)
59
    i += docalling (get_input (), &String::funcOne);
60
 
61
  if (i != 104)
62
    abort();
63
  return 0;
64
}

powered by: WebSVN 2.1.0

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