mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
af55061b18
* ld-plugin/dummy.c: New file. * ld-plugin/dummy.s: Likewise. * ld-plugin/lto-11.out: Likewise. * ld-plugin/lto-11a.c: Likewise. * ld-plugin/lto-11b.c: Likewise. * ld-plugin/lto-11c.c: Likewise. * ld-plugin/lto-12.out: Likewise. * ld-plugin/lto-12a.c: Likewise. * ld-plugin/lto-12b.c: Likewise. * ld-plugin/lto-12c.c: Likewise. * ld-plugin/lto-13.out: Likewise. * ld-plugin/lto-13a.c: Likewise. * ld-plugin/lto-13b.c: Likewise. * ld-plugin/lto-13c.c: Likewise. * ld-plugin/lto-14.out: Likewise. * ld-plugin/lto-14a.c: Likewise. * ld-plugin/lto-14b.c: Likewise. * ld-plugin/lto-14c.c: Likewise. * ld-plugin/lto-15.out: Likewise. * ld-plugin/lto-15a.c: Likewise. * ld-plugin/lto-15b.c: Likewise. * ld-plugin/lto-16a.c: Likewise. * ld-plugin/lto-16a.d: Likewise. * ld-plugin/lto-16b.c: Likewise. * ld-plugin/lto-16b.d: Likewise. * ld-plugin/lto-17a.c: Likewise. * ld-plugin/lto-17a.d: Likewise. * ld-plugin/lto-17b-1.d: Likewise. * ld-plugin/lto-17b-2.d: Likewise. * ld-plugin/lto-17b.c: Likewise. * ld-plugin/lto-1a.c: Likewise. * ld-plugin/lto-1b.c: Likewise. * ld-plugin/lto-2.c: Likewise. * ld-plugin/lto-3.d: Likewise. * ld-plugin/lto-3.out: Likewise. * ld-plugin/lto-3a.c: Likewise. * ld-plugin/lto-3b.c: Likewise. * ld-plugin/lto-3c.c: Likewise. * ld-plugin/lto-3r.d: Likewise. * ld-plugin/lto-5.d: Likewise. * ld-plugin/lto-5.out: Likewise. * ld-plugin/lto-5a.c: Likewise. * ld-plugin/lto-5b.c: Likewise. * ld-plugin/lto-5r.d: Likewise. * ld-plugin/lto-6.c: Likewise. * ld-plugin/lto-7.out: Likewise. * ld-plugin/lto-7a.c: Likewise. * ld-plugin/lto-7b.c: Likewise. * ld-plugin/lto-7c.c: Likewise. * ld-plugin/lto-7d.c: Likewise. * ld-plugin/lto-8.out: Likewise. * ld-plugin/lto-8a.c: Likewise. * ld-plugin/lto-8b.c: Likewise. * ld-plugin/lto-9.cc: Likewise. * ld-plugin/lto-9.d: Likewise. * ld-plugin/lto.exp: Likewise. * ld-plugin/pr12696-1.cc: Likewise. * ld-plugin/pr12758a.s: Likewise. * ld-plugin/pr12758b.c: Likewise. * ld-plugin/pr12760a.c: Likewise. * ld-plugin/pr12760b.c: Likewise. * ld-plugin/pr12942.out: Likewise. * ld-plugin/pr12942a.cc: Likewise. * ld-plugin/pr12942a.h: Likewise. * ld-plugin/pr12942b.cc: Likewise. * ld-plugin/pr12942c.cc: Likewise. * ld-plugin/pr12975.c: Likewise. * ld-plugin/pr12975.d: Likewise. * ld-plugin/pr12975.t: Likewise. * ld-plugin/pr12982.c: Likewise. * ld-plugin/pr12982.d: Likewise. * ld-plugin/pr13066.cc: Likewise. * ld-plugin/pr13066.out: Likewise. * ld-plugin/pr13183.d: Likewise. * ld-plugin/pr13183a.c: Likewise. * ld-plugin/pr13183b.c: Likewise. * ld-plugin/pr13201.c: Likewise. * ld-plugin/pr13201.out: Likewise. * ld-plugin/pr13229.cc: Likewise. * ld-plugin/pr13229.d: Likewise. * ld-plugin/pr13244.c: Likewise. * ld-plugin/pr13244.d: Likewise. * ld-plugin/pr13287.cc: Likewise. * ld-plugin/run-ie.c: Likewise. * ld-plugin/run-ie.out: Likewise.
86 lines
1.2 KiB
C++
86 lines
1.2 KiB
C++
#include <stdio.h>
|
|
|
|
template <typename V> struct S
|
|
{
|
|
V *f, *l;
|
|
__attribute__ ((noinline)) S (void) { f = 0, l = 0; }
|
|
void foo (V *x)
|
|
{
|
|
if (x->p != 0)
|
|
x->p->n = x->n;
|
|
else
|
|
f = x->n;
|
|
if (x->n != 0)
|
|
x->n->p = x->p;
|
|
else
|
|
l = x->p;
|
|
}
|
|
__attribute__ ((noinline)) void bar (V *x)
|
|
{
|
|
x->n = 0;
|
|
x->p = l;
|
|
if (l != 0)
|
|
l->n = x;
|
|
else
|
|
f = x;
|
|
l = x;
|
|
}
|
|
};
|
|
|
|
struct H;
|
|
|
|
struct A
|
|
{
|
|
S <H> k;
|
|
};
|
|
|
|
struct H
|
|
{
|
|
A *a;
|
|
H *p, *n;
|
|
__attribute__ ((noinline)) H (void) { p = 0, n = 0, a = 0; }
|
|
__attribute__ ((noinline)) H (A *b) : a (b)
|
|
{
|
|
p = 0;
|
|
n = 0;
|
|
if (a != 0)
|
|
a->k.bar (this);
|
|
}
|
|
__attribute__ ((noinline)) H (const H &h) : a (h.a)
|
|
{
|
|
p = 0;
|
|
n = 0;
|
|
if (a != 0)
|
|
a->k.bar (this);
|
|
}
|
|
~H (void) { if (a != 0) a->k.foo (this); }
|
|
H &operator= (const H &o)
|
|
{
|
|
if (a != 0 || &o == this)
|
|
__builtin_abort ();
|
|
a = o.a;
|
|
if (a != 0)
|
|
a->k.bar (this);
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
__attribute__ ((noinline))
|
|
H baz (void)
|
|
{
|
|
return H (new A);
|
|
}
|
|
|
|
H g;
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
g = baz ();
|
|
if (g.a->k.f != &g)
|
|
__builtin_abort ();
|
|
printf ("OK\n");
|
|
return 0;
|
|
}
|
|
|