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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [tree-ssa/] [pr13146.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-do link } */
2
/* { dg-options "-O -fstrict-aliasing" } */
3
 
4
class first
5
{
6
public:
7
  double d;
8
  int f1;
9
};
10
 
11
class middle : public first
12
{
13
};
14
 
15
class second : public middle
16
{
17
public:
18
  int f2;
19
  short a;
20
};
21
 
22
class third
23
{
24
public:
25
  char a;
26
  char b;
27
};
28
 
29
class multi: public third, public second
30
{
31
public:
32
  short s;
33
  /* The following field used to be of type char but that causes
34
     class multi to effectively get alias-set zero which we end
35
     up not optimizing because of the fix for PR44164.  */
36
  int f3;
37
};
38
 
39
extern void link_error ();
40
 
41
void
42
foo (first *s1, second *s2)
43
{
44
  s1->f1 = 0;
45
  s2->f2 = 0;
46
  s1->f1++;
47
  s2->f2++;
48
  s1->f1++;
49
  s2->f2++;
50
  if (s1->f1 != 2)
51
    link_error ();
52
}
53
 
54
void
55
bar (first *s1, multi *s3)
56
{
57
  s1->f1 = 0;
58
  s3->f3 = 0;
59
  s1->f1++;
60
  s3->f3++;
61
  s1->f1++;
62
  s3->f3++;
63
  if (s1->f1 != 2)
64
    link_error ();
65
}
66
 
67
 
68
int
69
main()
70
{
71
  first a;
72
  second b;
73
  multi c;
74
  foo (&a, &b);
75
  bar (&a, &c);
76
  return 0;
77
}

powered by: WebSVN 2.1.0

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