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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.brendan/] [crash56.C] - Blame information for rev 305

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
// { dg-options "" }
3
// GROUPS passed old-abort
4
 
5
const bool FALSE = 0;
6
const bool TRUE = 1;
7
class ListDProto {
8
protected:
9
    class link;
10
public:
11
    ListDProto();
12
    ListDProto(const ListDProto&);
13
    virtual ~ListDProto();
14
    void operator=(const ListDProto&);
15
    unsigned length() const;
16
    bool empty() const;
17
    void clear();
18
    void remove_head();
19
    void remove_tail();
20
    class Vix {
21
    public:
22
        Vix();
23
        friend int operator==(void *v, const Vix& x)
24
            { return v == x.item; }
25
        friend int operator==(const Vix& x, void *v)
26
            { return v == x.item; }
27
        friend int operator!=(void *v, const Vix& x)
28
            { return v != x.item; }
29
        friend int operator!=(const Vix& x, void *v)
30
            { return v != x.item; }
31
        friend int operator==(const Vix& x1, const Vix& x2)
32
            { return x1.owner == x2.owner && x1.item == x2.item; }
33
        friend int operator!=(const Vix& x1, const Vix& x2)
34
            { return x1.owner != x2.owner || x1.item != x2.item; }
35
        bool first;
36
        bool last;
37
    protected:
38
        friend class ListDProto;
39
        Vix(const ListDProto *o, link *i);
40
        const ListDProto *owner;
41
    private:
42
        link *item;
43
    };
44
    enum Action { NORMAL, REMOVE_CURRENT };
45
    Vix first() const;
46
    void first(Vix& x) const;
47
    void next(Vix& x) const;
48
    void next(Vix& x, Action a = NORMAL);
49
    Vix last() const;
50
    void last(Vix& x) const;
51
    void prev(Vix& x) const;
52
    void prev(Vix& x, Action a = NORMAL);
53
protected:
54
    struct link {
55
        link *next;
56
        link *prev;
57
        link(link *n = 0, link *p = 0);
58
        virtual ~link();
59
    private:
60
        link(const link&);
61
        void operator=(const link&);
62
    };
63
    unsigned count;
64
    link *list_head;
65
    link *list_tail;
66
    virtual link *copy_item(link *old_item) const = 0;
67
    void prepend(link *item);
68
    void append(link *item);
69
    void prepend(const ListDProto& proto);
70
    void append(const ListDProto& proto);
71
    void remove(link *item);
72
    link *ref(const Vix&) const;
73
};
74
template
75
class ListD: public ListDProto {
76
public:
77
    void prepend(const T& item);
78
    void append(const T& item);
79
    const T& head() const;
80
    T& head();
81
    void head(T& fill) const;
82
    void remove_head()
83
        { ListDProto::remove_head(); }
84
    void remove_head(T& fill);
85
    const T& tail() const;
86
    T& tail();
87
    void tail(T& fill) const;
88
    void remove_tail()
89
        { ListDProto::remove_tail(); }
90
    void remove_tail(T& fill);
91
    class Vix: public ListDProto::Vix {
92
    public:
93
        Vix(): ListDProto::Vix()
94
            { }
95
    protected:
96
        friend class ListD;
97
        Vix(const ListDProto::Vix& x): ListDProto::Vix(x)
98
            { }
99
    };
100
    Vix first() const
101
        { return ListDProto::first(); };
102
    void first(Vix& x) const
103
        { ListDProto::first(x); };
104
    void next(Vix& x, ListDProto::Action a = NORMAL) const
105
        { ListDProto::next(x, a); }// { dg-error "" } .*// ERROR - .*
106
    Vix last() const
107
        { return ListDProto::last(); }
108
    void last(Vix& x) const
109
        { return ListDProto::last(x); }
110
    void prev(Vix& x, ListDProto::Action a = NORMAL) const
111
        { return ListDProto::prev(x, a); }
112
protected:
113
    struct link_item: public ListDProto::link {
114
        T item;
115
        link_item(const T& i): link(0, 0), item(i)
116
            { }
117
    private:
118
        link_item(const link_item&);
119
        void operator=(const link_item&);
120
    };
121
public:
122
    T& operator()(const Vix& x)
123
        { link_item *li = (link_item *) ref(x);
124
          return li->item; }
125
    const T& operator()(const Vix& x) const
126
        { link_item *li = (link_item *) ref(x);
127
          return li->item; }
128
private:
129
    ListDProto::link *copy_item(ListDProto::link *old_item) const;
130
};
131
template
132
class SetLD: private ListD {
133
public:
134
    SetLD();
135
    SetLD(const ListD&);
136
    void add(const T& item);
137
    void add(const ListD& other);
138
    void add(const SetLD& other);
139
    void remove(const T& item);
140
    bool contains(const T& item) const;
141
    ListD::length;
142
    ListD::empty;
143
    ListD::clear;
144
    typedef typename ListD::Vix Vix;
145
    ListD::first;
146
    ListD::next;
147
    ListD::operator();
148
 
149
  using ListD::NORMAL;
150
  using ListD::REMOVE_CURRENT;
151
};
152
extern "C" {
153
extern void __eprintf (const char *, const char *, unsigned, const char *);
154
}
155
extern "C" {
156
extern void __eprintf (const char *, const char *, unsigned, const char *);
157
}
158
template
159
void
160
ListD::prepend(const T& item)
161
{
162
    link *newl = new link_item(item);
163
    ListDProto::prepend(newl);
164
}
165
template
166
void
167
ListD::append(const T& item)
168
{
169
    link *newl = new link_item(item);
170
    ListDProto::append(newl);
171
}
172
template
173
const T&
174
ListD::head() const
175
{
176
    ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   50 ,  "0 != list_head" ), 0) )) ;
177
    link_item *h = (link_item *) list_head;
178
    return h->item;
179
}
180
template
181
T&
182
ListD::head()
183
{
184
    ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   59 ,  "0 != list_head" ), 0) )) ;
185
    link_item *h = (link_item *) list_head;
186
    return h->item;
187
}
188
template
189
void
190
ListD::head(T& fill) const
191
{
192
    ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   68 ,  "0 != list_head" ), 0) )) ;
193
    link_item *h = (link_item *) list_head;
194
    fill = h->item;
195
}
196
template
197
void
198
ListD::remove_head(T& fill)
199
{
200
    head(fill);
201
    remove_head();
202
}
203
template
204
const T&
205
ListD::tail() const
206
{
207
    ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   85 ,  "0 != list_tail" ), 0) )) ;
208
    link_item *h = (link_item *) list_tail;
209
    return h->item;
210
}
211
template
212
T&
213
ListD::tail()
214
{
215
    ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   94 ,  "0 != list_tail" ), 0) )) ;
216
    link_item *h = (link_item *) list_tail;
217
    return h->item;
218
}
219
template
220
void
221
ListD::tail(T& fill) const
222
{
223
    ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   103 ,  "0 != list_tail" ), 0) )) ;
224
    link_item *h = (link_item *) list_tail;
225
    fill = h->item;
226
}
227
template
228
void
229
ListD::remove_tail(T& fill)
230
{
231
    ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n",       "/home/wbaker/work/include/templates/ListD.body.h" ,   112 ,  "0 != list_tail" ), 0) )) ;
232
    link_item *h = (link_item *) list_tail;
233
    fill = h->item;
234
}
235
template
236
ListDProto::link *
237
ListD::copy_item(ListDProto::link *old) const
238
{
239
    link_item *old_item = (link_item *) old;
240
    link_item *new_item = new link_item(old_item->item);
241
    return new_item;
242
}
243
template
244
SetLD::SetLD():
245
ListD()
246
{ }
247
template
248
SetLD::SetLD(const ListD& other):
249
ListD(other)
250
{ }
251
template
252
void
253
SetLD::add(const T& item)
254
{
255
    if ( ! contains(item) )
256
        append(item);
257
}
258
template
259
void
260
SetLD::add(const ListD& other)
261
{
262
    typename ListD::Vix x;
263
    for (first(x); 0 != x; next(x))
264
        add(other(x));
265
}
266
template
267
void
268
SetLD::add(const SetLD& other)
269
{
270
    const ListD& lother = other;
271
    add(lother);
272
}
273
template
274
void
275
SetLD::remove(const T& item)
276
{
277
    typename ListD::Action a = this->NORMAL;
278
    Vix x;
279
    for (first(x); 0 != x && this->REMOVE_CURRENT != a; next(x, a))
280
        a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // { dg-error "" } .*
281
}
282
template
283
bool
284
SetLD::contains(const T& item) const
285
{
286
    Vix x;
287
    for (first(x); 0 != x; next(x)) {
288
        if (operator()(x) == item)// { dg-error "" } .*
289
            return TRUE;
290
    }
291
    return FALSE;
292
}
293
template
294
int
295
operator==(const SetLD& a, const SetLD& b)
296
{
297
    if (a.length() != b.length())
298
        return FALSE;
299
    typename SetLD::Vix x;
300
    for (a.first(x); 0 != x; a.next(x)) {
301
        if ( ! b.contains(a(x)) )
302
            return FALSE;
303
    }
304
    for (b.first(x); 0 != x; b.next(x)) {
305
        if ( ! a.contains(b(x)) )
306
            return FALSE;
307
    }
308
    return TRUE;
309
}
310
template
311
int
312
operator!=(const SetLD& a, const SetLD& b)
313
{ return ! (a == b); }
314
template
315
int
316
operator<=(const SetLD& a, const SetLD& b)
317
{
318
    if (a.length() > b.length())
319
        return FALSE;
320
    typename SetLD::Vix x;
321
    for (x=a.first(); 0 != x; a.next(x)) {
322
        if ( ! b.contains(a(x)) )
323
            return FALSE;
324
    }
325
    return TRUE;
326
}
327
template
328
int
329
operator<(const SetLD& a, const SetLD& b)
330
{
331
    if (a.length() >= b.length())
332
        return FALSE;
333
    return a <= b;
334
}
335
template
336
int
337
operator>(const SetLD& a, const SetLD& b)
338
{ return ! (a <= b); }
339
template
340
int
341
operator>=(const SetLD& a, const SetLD& b)
342
{ return ! (a < b); }
343
class String { };
344
class IcaseString: public String { };
345
template <> class SetLD< IcaseString >: public SetLD<    String  > {       public:  SetLD (): SetLD<    String  >() { };  SetLD (const ::ListD<   IcaseString  >& other): SetLD<    String  >()	{ ::ListD<   IcaseString  >::Vix x;  for (other.first(x); 0 != x; other.next(x))     add(other(x)); };        SetLD (const  SetLD & other): SetLD<    String  >(other) { };  const    IcaseString  & operator()(const Vix& x) const	{ return (   IcaseString  &) SetLD<    String  >::operator()(x); }       };      typedef SetLD<  String > SetLD_String_IcaseString_old_tmp99;       typedef SetLD< IcaseString > SetLD_String_IcaseString_new_tmp99;
346
inline int       operator== (const SetLD_String_IcaseString_new_tmp99& a,       const SetLD_String_IcaseString_new_tmp99& b) // { dg-message "operator==" }
347
{
348
const SetLD_String_IcaseString_old_tmp99& oa = a;
349
const SetLD_String_IcaseString_old_tmp99& ob = b;
350
return  operator== (oa, ob);    }
351
inline int       operator!= (const SetLD_String_IcaseString_new_tmp99& a,       const SetLD_String_IcaseString_new_tmp99& b)
352
{
353
const SetLD_String_IcaseString_old_tmp99& oa = a;
354
const SetLD_String_IcaseString_old_tmp99& ob = b;
355
return  operator!= (oa, ob);    }
356
inline int       operator< (const SetLD_String_IcaseString_new_tmp99& a,        const SetLD_String_IcaseString_new_tmp99& b)
357
{
358
const SetLD_String_IcaseString_old_tmp99& oa = a;
359
const SetLD_String_IcaseString_old_tmp99& ob = b;
360
return  operator< (oa, ob);     }
361
inline int       operator<= (const SetLD_String_IcaseString_new_tmp99& a,       const SetLD_String_IcaseString_new_tmp99& b)
362
{
363
const SetLD_String_IcaseString_old_tmp99& oa = a;
364
const SetLD_String_IcaseString_old_tmp99& ob = b;
365
return  operator<= (oa, ob);    }
366
inline int       operator> (const SetLD_String_IcaseString_new_tmp99& a,        const SetLD_String_IcaseString_new_tmp99& b)
367
{
368
const SetLD_String_IcaseString_old_tmp99& oa = a;
369
const SetLD_String_IcaseString_old_tmp99& ob = b;
370
return  operator> (oa, ob);     }
371
inline int       operator>= (const SetLD_String_IcaseString_new_tmp99& a,       const SetLD_String_IcaseString_new_tmp99& b)
372
{
373
const SetLD_String_IcaseString_old_tmp99& oa = a;
374
const SetLD_String_IcaseString_old_tmp99& ob = b;
375
return  operator>= (oa, ob);    }
376
typedef SetLD SLDiS;
377
static void
378
nop(int i)
379
{
380
    SetLD x, y;
381
    nop(x == y);
382
 nop(x != y);
383
nop(x < y);
384
nop(x <= y);
385
nop(x > y);
386
nop(x >= y);
387
}
388
 
389
template class SetLD;

powered by: WebSVN 2.1.0

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