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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.robertl/] [eh990323-2.C] - Blame information for rev 749

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

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// check MI and VBC offsets on throw
3
extern "C" void abort ();
4
extern "C" void exit (int);
5
 
6
struct A {
7
        int x[23];
8
};
9
 
10
struct B : virtual public A {
11
        int y[33];
12
};
13
 
14
struct C : virtual public A, public B {
15
        int z[43];
16
};
17
 
18
struct D {
19
        int xx[53];
20
};
21
 
22
struct E : public D, public A {
23
        int yy[63];
24
};
25
 
26
C c;
27
 
28
E e;
29
 
30
void f1()
31
{
32
        throw (C*)0;
33
}
34
 
35
void f2()
36
{
37
        throw &c;
38
}
39
 
40
void f3()
41
{
42
        throw (E*)0;
43
}
44
 
45
void f4()
46
{
47
        throw &e;
48
}
49
 
50
int main()
51
{
52
        int flag;
53
 
54
        flag = 0;
55
        try {
56
                f1();
57
        }
58
        catch (A* p) {
59
                if (p)
60
                        abort();
61
                flag = 1;
62
        }
63
        if (!flag)
64
                abort();
65
 
66
        flag = 0;
67
        try {
68
                f2();
69
        }
70
        catch (A* p) {
71
                if (!p || (void*)p == (void*)&c)
72
                        abort();
73
                flag = 1;
74
        }
75
        if (!flag)
76
                abort();
77
 
78
        flag = 0;
79
        try {
80
                f3();
81
        }
82
        catch (A* p) {
83
                if (p)
84
                        abort();
85
                flag = 1;
86
        }
87
        if (!flag)
88
                abort();
89
 
90
        flag = 0;
91
        try {
92
                f4();
93
        }
94
        catch (A* p) {
95
                if (!p || (void*)p == (void*)&e)
96
                        abort();
97
                flag = 1;
98
        }
99
        if (!flag)
100
                abort();
101
 
102
        exit(0);
103
}

powered by: WebSVN 2.1.0

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