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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [optimize1.C] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run  }
2
// { dg-options "-O2" }
3
//
4
// Copyright (C) 2001 Free Software Foundation, Inc.
5
// Contributed by Nathan Sidwell 18 May 2001 
6
 
7
// Bug 2781. We forgot to copy addressability information when
8
// cloning.
9
 
10
struct B
11
{
12
  B(int v1);
13
  void Member (int v1);
14
  static void Static (int v1);
15
};
16
 
17
struct D : B
18
{
19
  D (int v1);
20
};
21
 
22
void xswap(int& x1) ;
23
 
24
int xxx = 0;
25
 
26
B::B(int v1)
27
{
28
  xswap(v1);
29
  xxx = v1;
30
}
31
 
32
void B::Member(int v1)
33
{
34
  xswap(v1);
35
  xxx = v1;
36
}
37
 
38
void B::Static(int v1)
39
{
40
  xswap(v1);
41
  xxx = v1;
42
}
43
 
44
D::D(int v1)
45
  : B (v1)
46
{
47
}
48
 
49
void xswap (int& x1) { x1 = 2; }
50
 
51
int main ()
52
{
53
  B p (1);
54
 
55
  if (xxx != 2)
56
    return 1;
57
 
58
  D q (1);
59
  if (xxx != 2)
60
    return 2;
61
 
62
  p.Member (1);
63
  if (xxx != 2)
64
    return 3;
65
 
66
  p.Static (1);
67
  if (xxx != 2)
68
    return 4;
69
 
70
  return 0;
71
}

powered by: WebSVN 2.1.0

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