summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/lto
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/lto')
-rw-r--r--gcc/testsuite/g++.dg/lto/20080709_0.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20080829_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20080904_0.C37
-rw-r--r--gcc/testsuite/g++.dg/lto/20080907_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20080908-1_0.C36
-rw-r--r--gcc/testsuite/g++.dg/lto/20080908-2_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20080908-3_0.C16
-rw-r--r--gcc/testsuite/g++.dg/lto/20080909-1_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20080910-1_0.C2
-rw-r--r--gcc/testsuite/g++.dg/lto/20080912-1_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20080912_0.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/20080915_0.C29
-rw-r--r--gcc/testsuite/g++.dg/lto/20080916_0.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20080917_0.C29
-rw-r--r--gcc/testsuite/g++.dg/lto/20080924_0.C16
-rw-r--r--gcc/testsuite/g++.dg/lto/20080926_0.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/20081008_0.C36
-rw-r--r--gcc/testsuite/g++.dg/lto/20081022.h8
-rw-r--r--gcc/testsuite/g++.dg/lto/20081022_0.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20081022_1.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20081023_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20081109-1_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20081109-2_0.C15
-rw-r--r--gcc/testsuite/g++.dg/lto/20081109_0.C28
-rw-r--r--gcc/testsuite/g++.dg/lto/20081109_1.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118-1_0.C27
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118-1_1.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118_0.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118_1.C21
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119-1.h8
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119-1_0.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119-1_1.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119_0.C24
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119_1.C18
-rw-r--r--gcc/testsuite/g++.dg/lto/20081120-1_0.C10
-rw-r--r--gcc/testsuite/g++.dg/lto/20081120-1_1.C8
-rw-r--r--gcc/testsuite/g++.dg/lto/20081120-2_0.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/20081120-2_1.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20081123_0.C8
-rw-r--r--gcc/testsuite/g++.dg/lto/20081123_1.C16
-rw-r--r--gcc/testsuite/g++.dg/lto/20081125.h15
-rw-r--r--gcc/testsuite/g++.dg/lto/20081125_0.C18
-rw-r--r--gcc/testsuite/g++.dg/lto/20081125_1.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20081127_0.C2
-rw-r--r--gcc/testsuite/g++.dg/lto/20081127_1.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20081203_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20081203_1.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/20081204-1_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20081204-1_1.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20081204-2_0.C10
-rw-r--r--gcc/testsuite/g++.dg/lto/20081204-2_1.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20081209_0.C18
-rw-r--r--gcc/testsuite/g++.dg/lto/20081209_1.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20081211-1.h6
-rw-r--r--gcc/testsuite/g++.dg/lto/20081211-1_0.C19
-rw-r--r--gcc/testsuite/g++.dg/lto/20081211-1_1.C6
-rw-r--r--gcc/testsuite/g++.dg/lto/20081217-1_0.C28
-rw-r--r--gcc/testsuite/g++.dg/lto/20081217-2_0.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/20081219_0.C72
-rw-r--r--gcc/testsuite/g++.dg/lto/20081219_1.C42
-rw-r--r--gcc/testsuite/g++.dg/lto/20090106_0.C203
-rw-r--r--gcc/testsuite/g++.dg/lto/20090112_0.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20090128_0.C88
-rw-r--r--gcc/testsuite/g++.dg/lto/20090221_0.C53
-rw-r--r--gcc/testsuite/g++.dg/lto/20090302_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20090302_1.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20090303_0.C23
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311-1.h22
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311-1_0.C34
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311-1_1.C28
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311_0.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311_1.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/20090312.h2
-rw-r--r--gcc/testsuite/g++.dg/lto/20090312_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20090312_1.C21
-rw-r--r--gcc/testsuite/g++.dg/lto/20090313_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20090313_1.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20090315_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20090315_1.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20091002-1_0.C58
-rw-r--r--gcc/testsuite/g++.dg/lto/20091002-2_0.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/20091002-3_0.C15
-rw-r--r--gcc/testsuite/g++.dg/lto/20091004-1_0.C35
-rw-r--r--gcc/testsuite/g++.dg/lto/20091004-1_1.C26
-rw-r--r--gcc/testsuite/g++.dg/lto/20091004-2_0.C29
-rw-r--r--gcc/testsuite/g++.dg/lto/20091004-2_1.C32
-rw-r--r--gcc/testsuite/g++.dg/lto/20091004-3_0.C18
-rw-r--r--gcc/testsuite/g++.dg/lto/20091004-3_1.C16
-rw-r--r--gcc/testsuite/g++.dg/lto/20091022-1_0.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/20091022-2_0.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20091026-1_0.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20091026-1_1.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20091026-1_a.h9
-rw-r--r--gcc/testsuite/g++.dg/lto/20091210-1_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20091210-1_0.h9
-rw-r--r--gcc/testsuite/g++.dg/lto/20091210-1_1.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20091219_0.C17
-rw-r--r--gcc/testsuite/g++.dg/lto/20100302.h9
-rw-r--r--gcc/testsuite/g++.dg/lto/20100302_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20100302_1.C8
-rw-r--r--gcc/testsuite/g++.dg/lto/20100423-1_0.C38
-rw-r--r--gcc/testsuite/g++.dg/lto/20100423-2_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20100423-3_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20100519-1_0.C23
-rw-r--r--gcc/testsuite/g++.dg/lto/20100603-1_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20100603-1_1.c2
-rw-r--r--gcc/testsuite/g++.dg/lto/20100721-1_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20100722-1_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20100723-1_0.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20100724-1_0.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20101009-1_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20101010-1_0.C109
-rw-r--r--gcc/testsuite/g++.dg/lto/20101010-2_0.C32
-rw-r--r--gcc/testsuite/g++.dg/lto/20101010-3_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20101010-4_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20101014-1_0.C16
-rw-r--r--gcc/testsuite/g++.dg/lto/20101014-2_0.C8
-rw-r--r--gcc/testsuite/g++.dg/lto/20101015-1_0.C31
-rw-r--r--gcc/testsuite/g++.dg/lto/20101015-2_0.C6
-rw-r--r--gcc/testsuite/g++.dg/lto/20101020-1_0.C8
-rw-r--r--gcc/testsuite/g++.dg/lto/20101020-1_0.h23
-rw-r--r--gcc/testsuite/g++.dg/lto/20101020-1_1.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20101126-1_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20101126-1_1.c4
-rw-r--r--gcc/testsuite/g++.dg/lto/20110311-1_0.C51
-rw-r--r--gcc/testsuite/g++.dg/lto/README35
-rw-r--r--gcc/testsuite/g++.dg/lto/lto.exp60
-rw-r--r--gcc/testsuite/g++.dg/lto/pr40818_0.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/pr45621.h8
-rw-r--r--gcc/testsuite/g++.dg/lto/pr45621_0.C10
-rw-r--r--gcc/testsuite/g++.dg/lto/pr45621_1.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/pr45679-1_0.C28
-rw-r--r--gcc/testsuite/g++.dg/lto/pr45679-1_1.C77
-rw-r--r--gcc/testsuite/g++.dg/lto/pr45679-2_0.C119
-rw-r--r--gcc/testsuite/g++.dg/lto/pr45679-2_1.C100
-rw-r--r--gcc/testsuite/g++.dg/lto/pr45983_0.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/pr47333.C944
-rw-r--r--gcc/testsuite/g++.dg/lto/pr48207-2_0.C10
-rw-r--r--gcc/testsuite/g++.dg/lto/pr48207-3_0.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/pr48207_0.C13
140 files changed, 3753 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/lto/20080709_0.C b/gcc/testsuite/g++.dg/lto/20080709_0.C
new file mode 100644
index 000000000..55ae8c9ec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080709_0.C
@@ -0,0 +1,11 @@
+// { dg-lto-do run }
+
+class Init {
+};
+
+int f(Init *a) {
+}
+
+int main(void){
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080829_0.C b/gcc/testsuite/g++.dg/lto/20080829_0.C
new file mode 100644
index 000000000..0890cf66d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080829_0.C
@@ -0,0 +1,9 @@
+// { dg-lto-do assemble }
+
+/* The replacement of cos+sin with __builtin_cexpi done by
+ pass_cse_sincos was using a builtin for which we had no attributes.
+ This was causing the operand scanner to materialize a VDEF at the
+ builtin call-site which was not marked for renaming, thus tripping
+ up the SSA verifier. */
+extern "C" { extern double cos (double); extern double sin (double); }
+double func(double &in) { return cos(in) + sin(in); }
diff --git a/gcc/testsuite/g++.dg/lto/20080904_0.C b/gcc/testsuite/g++.dg/lto/20080904_0.C
new file mode 100644
index 000000000..0161a00be
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080904_0.C
@@ -0,0 +1,37 @@
+// { dg-lto-do run }
+
+/* This test will fail to link if the vtable for Derived is not emitted. */
+
+class Base {
+public:
+ Base(char *buf, unsigned len)
+ : _buf(buf),
+ _len(len)
+ {}
+
+ virtual int length () { return _len; }
+
+private:
+ char * _buf;
+ unsigned _len;
+};
+
+class Derived : public Base {
+public:
+ Derived(char *buf, unsigned len)
+ : Base(buf, len),
+ _ctr(len)
+ {}
+
+ virtual int length () { return _ctr; }
+
+private:
+ unsigned _ctr;
+};
+
+int main ()
+{
+ Derived *d = new Derived (new char[256], 256);
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080907_0.C b/gcc/testsuite/g++.dg/lto/20080907_0.C
new file mode 100644
index 000000000..9a4552310
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080907_0.C
@@ -0,0 +1,3 @@
+// { dg-lto-do assemble }
+struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
+Baz dummy() { bar().func(); }
diff --git a/gcc/testsuite/g++.dg/lto/20080908-1_0.C b/gcc/testsuite/g++.dg/lto/20080908-1_0.C
new file mode 100644
index 000000000..8b761c084
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080908-1_0.C
@@ -0,0 +1,36 @@
+/* { dg-lto-do run } */
+extern "C" { extern void *memcpy (void *, const void *, unsigned); }
+
+inline int
+bci (const float &source)
+{
+ int dest;
+ memcpy (&dest, &source, sizeof (dest));
+ return dest;
+}
+
+inline float
+bcf (const int &source)
+{
+ float dest;
+ memcpy (&dest, &source, sizeof (dest));
+ return dest;
+}
+
+float
+Foo ()
+{
+ const int foo = bci (0.0f);
+ int bar = foo;
+ const int baz = foo & 1;
+ if (!baz && (foo & 2))
+ bar = 0;
+ return bcf (bar);
+}
+
+int main ()
+{
+ if (Foo () != 0.0)
+ return 1;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080908-2_0.C b/gcc/testsuite/g++.dg/lto/20080908-2_0.C
new file mode 100644
index 000000000..7042b3d08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080908-2_0.C
@@ -0,0 +1,3 @@
+/* { dg-lto-do assemble } */
+struct Foo { double x[3]; };
+Foo func() { Foo f = { { 0, 0, 0 } }; return f; }
diff --git a/gcc/testsuite/g++.dg/lto/20080908-3_0.C b/gcc/testsuite/g++.dg/lto/20080908-3_0.C
new file mode 100644
index 000000000..dac3cddb6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080908-3_0.C
@@ -0,0 +1,16 @@
+/* { dg-lto-do run } */
+
+volatile double bar;
+
+int foo()
+{
+ double baz = -__builtin_huge_val();
+ return baz <= -bar;
+}
+
+int main()
+{
+ if (foo () != 1)
+ return 1;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080909-1_0.C b/gcc/testsuite/g++.dg/lto/20080909-1_0.C
new file mode 100644
index 000000000..245ca58f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080909-1_0.C
@@ -0,0 +1,3 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-flto}} }
+int *i = (int[]) {0};
diff --git a/gcc/testsuite/g++.dg/lto/20080910-1_0.C b/gcc/testsuite/g++.dg/lto/20080910-1_0.C
new file mode 100644
index 000000000..48e9e5d15
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080910-1_0.C
@@ -0,0 +1,2 @@
+// { dg-lto-do assemble }
+struct Foo { Foo(int); }; void func() { new Foo(0); }
diff --git a/gcc/testsuite/g++.dg/lto/20080912-1_0.C b/gcc/testsuite/g++.dg/lto/20080912-1_0.C
new file mode 100644
index 000000000..ebead90e0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080912-1_0.C
@@ -0,0 +1,3 @@
+// { dg-lto-do assemble }
+struct Foo { double x[3]; };
+Foo func() { Foo f = { { 0, 0, 0 } }; return f; }
diff --git a/gcc/testsuite/g++.dg/lto/20080912_0.C b/gcc/testsuite/g++.dg/lto/20080912_0.C
new file mode 100644
index 000000000..7b3039fbf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080912_0.C
@@ -0,0 +1,4 @@
+// { dg-lto-do assemble }
+class Foo { virtual void f(); };
+class Bar:public Foo { };
+void func() { Bar(); }
diff --git a/gcc/testsuite/g++.dg/lto/20080915_0.C b/gcc/testsuite/g++.dg/lto/20080915_0.C
new file mode 100644
index 000000000..3789765a9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080915_0.C
@@ -0,0 +1,29 @@
+// { dg-lto-do assemble }
+struct Foo {
+ static const int dummy;
+
+ int bit_field:1;
+ int dummy2:1;
+ int dummy3:1;
+};
+
+struct Bar {
+ Foo foo;
+};
+
+int func(const Bar& b) {
+ return b.foo.bit_field;
+}
+
+struct Baz {
+ Bar& operator*() {}
+};
+
+void func1(Baz baz, int i, Bar bar) {
+ i || func(bar);
+ *baz = bar;
+}
+
+void func2(Baz baz, Bar bar) {
+ func1(baz, 0, bar);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080916_0.C b/gcc/testsuite/g++.dg/lto/20080916_0.C
new file mode 100644
index 000000000..3c900cd43
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080916_0.C
@@ -0,0 +1,12 @@
+/* { dg-lto-do assemble } */
+
+enum _Ios_Fmtflags {
+ _S_boolalpha };
+
+class ios_base {
+ static const _Ios_Fmtflags boolalpha = _S_boolalpha;
+ _Ios_Fmtflags _M_flags;
+};
+
+ios_base& g() {
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080917_0.C b/gcc/testsuite/g++.dg/lto/20080917_0.C
new file mode 100644
index 000000000..2f4f33bd0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080917_0.C
@@ -0,0 +1,29 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-O2 -flto -funsigned-char}} }
+int
+foo (char *s, int flag)
+{
+ for (;;)
+ {
+ unsigned char c;
+ if (flag)
+ c = *s;
+ else
+ c = *s;
+ return c;
+ }
+}
+
+int
+baz (const char *s, int flag)
+{
+ for (;;)
+ {
+ unsigned char c;
+ if (flag)
+ c = *s;
+ else
+ c = *s;
+ return c;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080924_0.C b/gcc/testsuite/g++.dg/lto/20080924_0.C
new file mode 100644
index 000000000..b1e381351
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080924_0.C
@@ -0,0 +1,16 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-O2 -flto -fno-strict-aliasing}} }
+
+namespace ns
+{
+ template <class> class hash_set { };
+}
+
+struct Foo
+{
+ long long f1, f2, f3;
+};
+
+void func(ns::hash_set<int>) {
+ Foo foo = { 0, 0, 0 };
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080926_0.C b/gcc/testsuite/g++.dg/lto/20080926_0.C
new file mode 100644
index 000000000..d6a7bbffc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080926_0.C
@@ -0,0 +1,4 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-O2 -flto -fno-strict-aliasing}} }
+extern int foo();
+void bar() { try { int i = foo(); } catch(int) { } }
diff --git a/gcc/testsuite/g++.dg/lto/20081008_0.C b/gcc/testsuite/g++.dg/lto/20081008_0.C
new file mode 100644
index 000000000..258265a4f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081008_0.C
@@ -0,0 +1,36 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-flto}} }
+
+struct Foo
+{
+ virtual void func() = 0;
+};
+
+struct Bar
+{
+ Foo *field;
+ void func2();
+};
+
+struct Baz
+{
+ Bar &bar();
+ Baz();
+};
+
+struct Zonk
+{
+ virtual ~Zonk() {
+ }
+ virtual void func3() = 0;
+};
+
+void Mumble(Zonk *) {
+}
+
+extern "C"
+{
+ void __attribute__ ((nothrow)) __cxa_pure_virtual() {
+ Baz().bar().func2();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081022.h b/gcc/testsuite/g++.dg/lto/20081022.h
new file mode 100644
index 000000000..bccd2ad7b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081022.h
@@ -0,0 +1,8 @@
+class foo
+{
+public:
+ int bar ()
+ {
+ return 0;
+ }
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081022_0.C b/gcc/testsuite/g++.dg/lto/20081022_0.C
new file mode 100644
index 000000000..219f92d6a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081022_0.C
@@ -0,0 +1,11 @@
+#include "20081022.h"
+
+int
+f (foo * a)
+{
+ return a->bar ();
+}
+
+main()
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081022_1.C b/gcc/testsuite/g++.dg/lto/20081022_1.C
new file mode 100644
index 000000000..94c5aecfd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081022_1.C
@@ -0,0 +1,7 @@
+#include "20081022.h"
+
+int
+g (foo * a)
+{
+ return a->bar ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081023_0.C b/gcc/testsuite/g++.dg/lto/20081023_0.C
new file mode 100644
index 000000000..ab3fc36f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081023_0.C
@@ -0,0 +1,14 @@
+// { dg-lto-do link }
+extern inline void __attribute__ ((__always_inline__)) func (void)
+{
+}
+
+void
+f (void)
+{
+ func ();
+}
+
+main()
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081109-1_0.C b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
new file mode 100644
index 000000000..474ceba79
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
@@ -0,0 +1,5 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC -flto -flto-partition=1to1}} }
+// { dg-extra-ld-options "-fPIC -flto -flto-partition=1to1 -r -nostdlib -fno-exceptions" }
+void func(); class Foo { };
+void bar() { try { func(); } catch (Foo) { } };
diff --git a/gcc/testsuite/g++.dg/lto/20081109-2_0.C b/gcc/testsuite/g++.dg/lto/20081109-2_0.C
new file mode 100644
index 000000000..dc43286bf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081109-2_0.C
@@ -0,0 +1,15 @@
+/* { dg-lto-do assemble } */
+extern void func(int);
+
+struct Foo
+{
+ void bar() {
+ static int local;
+ func(local);
+ }
+ void baz();
+};
+
+void Foo::baz() {
+ bar();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081109_0.C b/gcc/testsuite/g++.dg/lto/20081109_0.C
new file mode 100644
index 000000000..93cfc67ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081109_0.C
@@ -0,0 +1,28 @@
+extern "C" { void abort (void);}
+int foo (int);
+
+class A
+{
+ int x;
+
+public:
+ A() { x = 2304; }
+ ~A() { if (x != 2305) abort (); }
+ void inc () { x++; }
+};
+
+
+int main()
+{
+ A x;
+ x.inc();
+ try
+ {
+ foo (0);
+ abort (); // Should not execute
+ }
+ catch (int e)
+ {
+ return 0;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081109_1.C b/gcc/testsuite/g++.dg/lto/20081109_1.C
new file mode 100644
index 000000000..3395e1355
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081109_1.C
@@ -0,0 +1,4 @@
+int foo (int x)
+{
+ throw 10;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118-1_0.C b/gcc/testsuite/g++.dg/lto/20081118-1_0.C
new file mode 100644
index 000000000..99e024f9e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081118-1_0.C
@@ -0,0 +1,27 @@
+/* { dg-lto-do link } */
+
+class C {
+ public:
+ C();
+ virtual ~C();
+ virtual void foo();
+};
+void bar() {
+ new C();
+}
+
+C::C() {
+
+}
+
+C::~C() {
+
+}
+
+void C::foo() {
+}
+
+int main(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118-1_1.C b/gcc/testsuite/g++.dg/lto/20081118-1_1.C
new file mode 100644
index 000000000..fc654fe91
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081118-1_1.C
@@ -0,0 +1,12 @@
+class C {
+ public:
+ C();
+ virtual ~C();
+ virtual void foo();
+};
+class D {
+ ~D();
+ C lexer_;
+};
+D::~D() {
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118_0.C b/gcc/testsuite/g++.dg/lto/20081118_0.C
new file mode 100644
index 000000000..f11c76b67
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081118_0.C
@@ -0,0 +1,20 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -r -nostdlib}} } */
+
+/* We used to ICE because of dangling pointers. */
+
+class object
+{
+public:
+ virtual ~object() {}
+};
+
+class foo : public object
+{
+ virtual int method(void);
+};
+
+int
+foo::method(void)
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118_1.C b/gcc/testsuite/g++.dg/lto/20081118_1.C
new file mode 100644
index 000000000..a1bf08186
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081118_1.C
@@ -0,0 +1,21 @@
+class object {
+public:
+ virtual ~object() {}
+};
+
+class bar : public object
+{
+ static bar *method(void);
+};
+
+class quxx : public bar
+{
+ public:
+ static void method();
+};
+
+bar*
+bar::method (void)
+{
+ quxx::method();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119-1.h b/gcc/testsuite/g++.dg/lto/20081119-1.h
new file mode 100644
index 000000000..be193581d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119-1.h
@@ -0,0 +1,8 @@
+namespace __gnu_cxx
+{
+ template < typename _Tp > class new_allocator
+ {
+ public:
+ unsigned max_size () const throw ();
+ };
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119-1_0.C b/gcc/testsuite/g++.dg/lto/20081119-1_0.C
new file mode 100644
index 000000000..a2d5bd320
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119-1_0.C
@@ -0,0 +1,12 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -r -nostdlib}} } */
+
+#include "20081119-1.h"
+
+extern __gnu_cxx::new_allocator<int> X;
+
+int
+f (__gnu_cxx::new_allocator<int> * a)
+{
+ return a->max_size () + X.max_size();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119-1_1.C b/gcc/testsuite/g++.dg/lto/20081119-1_1.C
new file mode 100644
index 000000000..c2ba78d6e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119-1_1.C
@@ -0,0 +1,9 @@
+#include "20081119-1.h"
+
+__gnu_cxx::new_allocator<int> X;
+
+int
+f (__gnu_cxx::new_allocator<int> a)
+{
+ return a.max_size ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119_0.C b/gcc/testsuite/g++.dg/lto/20081119_0.C
new file mode 100644
index 000000000..c77a43098
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119_0.C
@@ -0,0 +1,24 @@
+class foo {
+ public:
+ foo () {}
+ virtual ~foo() {}
+ virtual void m() {}
+};
+
+template<typename t>
+class bar : public foo {
+ public:
+ bar () {}
+};
+
+void
+f1 (bar<int> *p)
+{
+ p->m();
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119_1.C b/gcc/testsuite/g++.dg/lto/20081119_1.C
new file mode 100644
index 000000000..71a2a5c02
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119_1.C
@@ -0,0 +1,18 @@
+class foo {
+ public:
+ foo () {}
+ virtual ~foo() {}
+ virtual void m() {}
+};
+
+template<typename t>
+class bar : public foo {
+ public:
+ bar () {}
+};
+
+void
+f2 (bar<int> *p)
+{
+ p->m();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081120-1_0.C b/gcc/testsuite/g++.dg/lto/20081120-1_0.C
new file mode 100644
index 000000000..682733778
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081120-1_0.C
@@ -0,0 +1,10 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -r -nostdlib}} }
+extern "C"
+{
+ extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int)
+ {
+ }
+}
+static __typeof(pthread_equal)
+ __gthrw_pthread_equal __attribute__((__weakref__("pthread_equal")));
diff --git a/gcc/testsuite/g++.dg/lto/20081120-1_1.C b/gcc/testsuite/g++.dg/lto/20081120-1_1.C
new file mode 100644
index 000000000..e7e24a58b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081120-1_1.C
@@ -0,0 +1,8 @@
+extern "C"
+{
+ extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int)
+ {
+ }
+}
+static __typeof(pthread_equal)
+ __gthrw_pthread_equal __attribute__((__weakref__("pthread_equal")));
diff --git a/gcc/testsuite/g++.dg/lto/20081120-2_0.C b/gcc/testsuite/g++.dg/lto/20081120-2_0.C
new file mode 100644
index 000000000..3efe26c01
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081120-2_0.C
@@ -0,0 +1,13 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -r -nostdlib}} }
+template < typename > struct Foo
+{
+ inline void rdstate() {
+ }
+};
+
+extern template struct Foo<int>;
+
+struct Bar:virtual public Foo<int>
+{
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081120-2_1.C b/gcc/testsuite/g++.dg/lto/20081120-2_1.C
new file mode 100644
index 000000000..242d50a41
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081120-2_1.C
@@ -0,0 +1,11 @@
+template < typename > struct Foo
+{
+ inline void rdstate() {
+ }
+};
+
+extern template struct Foo<int>;
+
+struct Bar:virtual public Foo<int>
+{
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081123_0.C b/gcc/testsuite/g++.dg/lto/20081123_0.C
new file mode 100644
index 000000000..8817be8f0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081123_0.C
@@ -0,0 +1,8 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -flto-partition=1to1 -r -nostdlib -fPIC}} }
+
+int
+f(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081123_1.C b/gcc/testsuite/g++.dg/lto/20081123_1.C
new file mode 100644
index 000000000..aef512e8e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081123_1.C
@@ -0,0 +1,16 @@
+struct foo {
+ const int* int_array;
+ const void* default_instance;
+};
+struct bar {
+ static const bar& _default_instance;
+ static const foo _internal_foo;
+};
+struct quxx {
+ static int trouble[];
+};
+int quxx::trouble[] = { };
+const foo bar::_internal_foo = {
+ quxx::trouble,
+ &bar::_default_instance
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081125.h b/gcc/testsuite/g++.dg/lto/20081125.h
new file mode 100644
index 000000000..bc470040a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081125.h
@@ -0,0 +1,15 @@
+class base
+{
+ public:
+ base() {}
+ virtual ~base() {}
+ static base *factory (void);
+};
+
+class object : public base
+{
+ public:
+ object() {}
+ object (int);
+ virtual void key_method (void);
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081125_0.C b/gcc/testsuite/g++.dg/lto/20081125_0.C
new file mode 100644
index 000000000..629c2b3d9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081125_0.C
@@ -0,0 +1,18 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -flto-partition=1to1}} }
+#include "20081125.h"
+
+object::object (int x)
+{
+}
+
+void
+object::key_method (void)
+{
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081125_1.C b/gcc/testsuite/g++.dg/lto/20081125_1.C
new file mode 100644
index 000000000..d52b9edca
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081125_1.C
@@ -0,0 +1,7 @@
+#include "20081125.h"
+
+base *
+base::factory(void)
+{
+ return new object ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081127_0.C b/gcc/testsuite/g++.dg/lto/20081127_0.C
new file mode 100644
index 000000000..a5200ff4b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081127_0.C
@@ -0,0 +1,2 @@
+struct Foo { Foo(); };
+static void func() { new Foo(); }
diff --git a/gcc/testsuite/g++.dg/lto/20081127_1.C b/gcc/testsuite/g++.dg/lto/20081127_1.C
new file mode 100644
index 000000000..6488ac8d7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081127_1.C
@@ -0,0 +1,3 @@
+struct Foo { Foo(); };
+Foo::Foo() { }
+main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20081203_0.C b/gcc/testsuite/g++.dg/lto/20081203_0.C
new file mode 100644
index 000000000..e92d89a4c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081203_0.C
@@ -0,0 +1,5 @@
+extern void f();
+extern void g();
+struct Foo { static inline void Bar() { f(); } };
+static void Func() { Foo::Bar(); }
+int main() { g (); Func(); return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20081203_1.C b/gcc/testsuite/g++.dg/lto/20081203_1.C
new file mode 100644
index 000000000..83de109ea
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081203_1.C
@@ -0,0 +1,4 @@
+void f () {}
+struct Foo { static inline void Bar() { f(); } };
+static void Func() { Foo::Bar(); }
+void g () { Func (); }
diff --git a/gcc/testsuite/g++.dg/lto/20081204-1_0.C b/gcc/testsuite/g++.dg/lto/20081204-1_0.C
new file mode 100644
index 000000000..0d2487889
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081204-1_0.C
@@ -0,0 +1,14 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-flto -flto-partition=1to1 -fPIC -r -nostdlib}} } */
+
+/* Tests for the absence during linking of:
+ lto1: error: type of '_ZTVN10__cxxabiv120__si_class_type_infoE' does
+ not match original declaration */
+
+struct Foo { virtual ~Foo(); };
+namespace __cxxabiv1
+{
+ struct __si_class_type_info: public Foo { };
+ struct Baz: public Foo { virtual void Func(); };
+ void Baz::Func() { }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081204-1_1.C b/gcc/testsuite/g++.dg/lto/20081204-1_1.C
new file mode 100644
index 000000000..20627b5c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081204-1_1.C
@@ -0,0 +1,3 @@
+struct Foo { virtual ~Foo(); };
+struct Bar:public Foo { Bar() { } };
+void Func() { new Bar(); }
diff --git a/gcc/testsuite/g++.dg/lto/20081204-2_0.C b/gcc/testsuite/g++.dg/lto/20081204-2_0.C
new file mode 100644
index 000000000..81a42693c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081204-2_0.C
@@ -0,0 +1,10 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -flto-partition=1to1 -O3}} }
+extern void foo (void);
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081204-2_1.C b/gcc/testsuite/g++.dg/lto/20081204-2_1.C
new file mode 100644
index 000000000..676b9b27d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081204-2_1.C
@@ -0,0 +1,14 @@
+namespace {
+class c
+{
+ public:
+ c () {}
+ virtual ~c() {}
+};
+};
+
+void
+foo (void)
+{
+ c x;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081209_0.C b/gcc/testsuite/g++.dg/lto/20081209_0.C
new file mode 100644
index 000000000..3744a9ac4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081209_0.C
@@ -0,0 +1,18 @@
+/* { dg-lto-do link } */
+
+class foo {
+ public:
+ foo ();
+ virtual ~foo ();
+};
+
+foo::foo ()
+{
+}
+
+int
+main ()
+{
+ foo dummy;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081209_1.C b/gcc/testsuite/g++.dg/lto/20081209_1.C
new file mode 100644
index 000000000..83eee3e46
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081209_1.C
@@ -0,0 +1,9 @@
+class foo {
+ public:
+ foo ();
+ virtual ~foo ();
+};
+
+foo::~foo ()
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081211-1.h b/gcc/testsuite/g++.dg/lto/20081211-1.h
new file mode 100644
index 000000000..f9a8ca755
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081211-1.h
@@ -0,0 +1,6 @@
+class foo {
+ public:
+ foo () {}
+ virtual ~foo () {}
+ virtual void key_method (void);
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081211-1_0.C b/gcc/testsuite/g++.dg/lto/20081211-1_0.C
new file mode 100644
index 000000000..89c06acf5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081211-1_0.C
@@ -0,0 +1,19 @@
+#include "20081211-1.h"
+
+foo *
+create_foo (void)
+{
+ return new foo;
+}
+
+void
+destroy_foo (foo *p)
+{
+ delete p;
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081211-1_1.C b/gcc/testsuite/g++.dg/lto/20081211-1_1.C
new file mode 100644
index 000000000..124d69a7c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081211-1_1.C
@@ -0,0 +1,6 @@
+#include "20081211-1.h"
+
+void
+foo::key_method (void)
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081217-1_0.C b/gcc/testsuite/g++.dg/lto/20081217-1_0.C
new file mode 100644
index 000000000..c91872bd2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081217-1_0.C
@@ -0,0 +1,28 @@
+class base1
+{
+ public:
+ base1 () {}
+ virtual ~base1 () {}
+};
+
+class base2
+{
+ public:
+ base2 () {}
+ virtual ~base2 () {}
+};
+
+class mi_class : public base1, base2
+{
+ public:
+ mi_class () {}
+ ~mi_class () {}
+};
+
+mi_class dummy;
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081217-2_0.C b/gcc/testsuite/g++.dg/lto/20081217-2_0.C
new file mode 100644
index 000000000..a47b0b578
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081217-2_0.C
@@ -0,0 +1,20 @@
+struct A {
+ virtual int foo() {}
+};
+struct B {
+ virtual int f() {return 1; }
+};
+struct C : public A, public B {
+ C();
+ virtual int f() { return 0; }
+};
+
+C::C()
+{
+}
+
+main()
+{
+ C c;
+ return c.f();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081219_0.C b/gcc/testsuite/g++.dg/lto/20081219_0.C
new file mode 100644
index 000000000..432a60c45
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081219_0.C
@@ -0,0 +1,72 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -O2}} }
+// { dg-extra-ld-options "-O2 -fPIC -flto -flto-partition=1to1 -r -nostdlib" }
+
+typedef long int ptrdiff_t;
+extern "C"
+{
+ typedef struct
+ {
+ }
+ __mbstate_t;
+ namespace std
+ {
+ class exception
+ {
+ };
+ }
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Alloc > class allocator;
+ template < class _CharT > struct char_traits;
+}
+typedef __mbstate_t mbstate_t;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ using::mbstate_t;
+ typedef ptrdiff_t streamsize;
+ template < typename _CharT, typename _Traits =
+ char_traits < _CharT > >class basic_istream;
+ template < typename _CharT, typename _Traits =
+ char_traits < _CharT >, typename _Alloc =
+ allocator < _CharT > >class basic_stringbuf;
+ class ios_base
+ {
+ public:class failure:public exception
+ {
+ };
+ virtual ~ ios_base ();
+ };
+ template < typename _CharT, typename _Traits > class basic_streambuf
+ {
+ };
+template < typename _CharT, typename _Traits > class basic_ios:public
+ ios_base
+ {
+ };
+template < typename _CharT, typename _Traits > class basic_istream:virtual public basic_ios < _CharT,
+ _Traits
+ >
+ {
+ typedef basic_streambuf < _CharT, _Traits > __streambuf_type;
+ protected:streamsize _M_gcount;
+ public: explicit basic_istream (__streambuf_type * __sb):_M_gcount (streamsize
+ (0))
+ {
+ }
+ };
+template < typename _CharT, typename _Traits, typename _Alloc > class basic_stringbuf:public basic_streambuf < _CharT,
+ _Traits
+ >
+ {
+ };
+ template < typename V, typename I, typename S = std::mbstate_t > struct character
+ {
+ };
+ typedef character < unsigned short, unsigned int >pod_ushort;
+ typedef basic_stringbuf < pod_ushort > stringbuf_type;
+ typedef basic_istream < pod_ushort > istream_type;
+ stringbuf_type strbuf01;
+ istream_type stream (&strbuf01);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081219_1.C b/gcc/testsuite/g++.dg/lto/20081219_1.C
new file mode 100644
index 000000000..1bb96ef37
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081219_1.C
@@ -0,0 +1,42 @@
+typedef struct
+{
+}
+__mbstate_t;
+typedef __mbstate_t mbstate_t;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ using::mbstate_t;
+ typedef int *__c_locale;
+ class locale
+ {
+ class facet;
+ };
+ class locale::facet
+ {
+ };
+template < typename _CharT > class numpunct:public locale::facet
+ {
+ void _M_initialize_numpunct (__c_locale __cloc = __null);
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ template < typename V, typename I, typename S = std::mbstate_t > struct character
+ {
+ };
+}
+
+namespace __gnu_test
+{
+ using __gnu_cxx::character;
+ typedef character < unsigned short, unsigned int >pod_ushort;
+}
+namespace std
+{
+ using __gnu_test::pod_ushort;
+ template <> void numpunct <
+ pod_ushort >::_M_initialize_numpunct (__c_locale)
+ {
+ pod_ushort *__truename = new pod_ushort[4 + 1];
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090106_0.C b/gcc/testsuite/g++.dg/lto/20090106_0.C
new file mode 100644
index 000000000..8c4d3952e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090106_0.C
@@ -0,0 +1,203 @@
+// { dg-lto-do link }
+typedef long unsigned int size_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ using ::size_t;
+ template<typename _Tp>
+ struct __is_char
+ {
+ };
+# 422 "/usr/include/c++/4.4.0/bits/cpp_type_traits.h" 3
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<bool, typename>
+ struct __enable_if
+ {
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<class _T1, class _T2>
+ struct pair
+ {
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp>
+ class new_allocator
+ {
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp>
+ class allocator: public __gnu_cxx::new_allocator<_Tp>
+ {
+ };
+ template<typename _Arg1, typename _Arg2, typename _Result>
+ struct binary_function
+ {
+ };
+ template<typename _Tp>
+ struct less : public binary_function<_Tp, _Tp, bool>
+ {
+ };
+ template<typename _CharT>
+ struct char_traits
+ {
+ typedef _CharT char_type;
+ static std::size_t
+ length(const char_type* __s);
+ };
+ template<typename _CharT>
+ std::size_t
+ char_traits<_CharT>::
+ length(const char_type* __p)
+ {
+ }
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class istreambuf_iterator;
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_string
+ {
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class __versa_string;
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ struct __vstring_utility
+ {
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class __rc_string_base
+ {
+ typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
+ typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+ struct _Rep
+ {
+ union
+ {
+ };
+ static _Rep*
+ _S_create(size_type, size_type, const _Alloc&);
+ };
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep*
+ __rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
+ _S_create(size_type __capacity, size_type __old_capacity,
+ const _Alloc& __alloc)
+ {
+ };
+}
+template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
+ typename _Alloc = std::allocator<_CharT> >
+class basic_string
+ : public __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> {
+};
+template<typename _CharT, typename _Traits, typename _Alloc>
+ operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const std::basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ {
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ struct __uninitialized_copy
+ {
+ template<typename _InputIterator, typename _ForwardIterator>
+ uninitialized_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
+ {
+ }
+ };
+ template<typename _InputIterator, typename _ForwardIterator>
+ uninitialized_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
+ {
+ }
+ class locale
+ {
+ class facet;
+ };
+ class locale::facet
+ {
+ };
+ class ios_base
+ {
+ template<typename _CharT2>
+ friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
+ istreambuf_iterator<_CharT2> >::__type
+ find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
+ const _CharT2&);
+ };
+ template<typename _CharT, typename _OutIter>
+ class num_put : public locale::facet
+ {
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+ template<typename _ValueT>
+ iter_type
+ _M_insert_float(iter_type, ios_base& __io, char_type __fill,
+ char __mod, _ValueT __v) const;
+ };
+ template<typename _CharT, typename _OutIter>
+ template<typename _ValueT>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod,
+ _ValueT __v) const
+ {
+ }
+ template<typename _CharT, typename _OutIter>
+ class basic_ios : public ios_base
+ {
+ };
+ template<typename _CharT, typename _Traits>
+ class basic_istream : virtual public basic_ios<_CharT, _Traits>
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ template<typename _ValueT>
+ __istream_type&
+ _M_extract(_ValueT& __v);
+ };
+ template<typename _CharT, typename _Traits>
+ template<typename _ValueT>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ _M_extract(_ValueT& __v)
+ {
+ }
+ class hash_map
+ {
+ };
+}
+class CDE {
+ public:
+ virtual ~CDE() { }
+};
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+ typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ class map
+ {
+ };
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return !(__x < __y); }
+}
+namespace xyz {
+class XYZ;
+};
+class ABC {
+ public:
+ virtual ~ABC() { }
+};
+class FGH : public CDE, public ABC {
+ public:
+ explicit FGH(CDE* efg);
+};
+namespace {
+class LMN : public FGH {
+ LMN(CDE* efg, xyz::XYZ* hij) : FGH(efg) { }
+};
+}
+main(){}
diff --git a/gcc/testsuite/g++.dg/lto/20090112_0.C b/gcc/testsuite/g++.dg/lto/20090112_0.C
new file mode 100644
index 000000000..b9dc24bc1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090112_0.C
@@ -0,0 +1,11 @@
+// { dg-lto-do run }
+const char *func(int val) {
+ switch (val) {
+ case 2147483647: return "foo";
+ default: return "";
+ }
+}
+
+int main() {
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090128_0.C b/gcc/testsuite/g++.dg/lto/20090128_0.C
new file mode 100644
index 000000000..d03cfc6a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090128_0.C
@@ -0,0 +1,88 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-fpreprocessed -O2 -flto -flto-partition=1to1 -funsigned-char}} }
+typedef unsigned char uint8;
+extern const uint8 array[256];
+static inline bool
+g (unsigned char c)
+{
+ return array[c] & 0x80;
+}
+
+class Class1
+{
+ static bool f1 (char **dst, const char *end, char c);
+ static bool f2 (const char *map, const char **src, char **dst,
+ const char *end);
+ static bool f3 (const char *src, char *dst, const char *end);
+};
+
+enum JTipL
+{
+ KXHR8 = 0, KXNU3, KX_HASH, KXYYZ, KXFI9, KXX3, KXAFA, KXV4Z, KXZ11,
+};
+
+static const char
+ p9t42[256] = { KXYYZ, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXAFA, KXX3, KX_HASH, KXAFA,
+ KXFI9, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXV4Z, KXAFA, KXAFA,
+ KXAFA, KXV4Z, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXHR8, KXX3, KXV4Z, KXX3, KXNU3,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXX3, KXX3, KXX3, KXX3, KXAFA, KXX3, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXX3, KXX3, KXX3, KXAFA, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+};
+
+inline bool
+Class1::f2 (const char *map, const char **src, char **dst,
+ const char *end)
+{
+ if (g ((*src)[1]) && g ((*src)[2]))
+ {
+ char c = (static_cast < unsigned char >((*src)[1])) & 0xf;
+ if (map[c] == KXAFA)
+ {
+ }
+ else if (f1 (dst, end, c))
+ {
+ }
+ }
+ return true;
+}
+
+bool
+Class1::f3 (const char *src, char *dst, const char *end)
+{
+ while (dst < end)
+ {
+ char c = *src;
+ char m = p9t42[c];
+ switch (m)
+ {
+ case KXYYZ:
+ *dst = '\0';
+ case KXFI9:
+ if (!f2 (p9t42, &src, &dst, end))
+ ;
+ }
+ }
+ return false;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090221_0.C b/gcc/testsuite/g++.dg/lto/20090221_0.C
new file mode 100644
index 000000000..5bf031906
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090221_0.C
@@ -0,0 +1,53 @@
+// { dg-lto-do assemble }
+extern void some_function (const char *);
+extern bool some_other_function ();
+
+struct Foo
+{
+ long long a;
+ int b;
+};
+
+bool Foo_eq(Foo x, Foo y)
+{
+ return x.a == y.a && x.b == y.b;
+}
+
+struct Bar
+{
+ Foo a;
+ int b;
+};
+
+struct Baz
+{
+ Bar a;
+ Baz(Bar &a):a(a) { }
+};
+
+struct Zonk
+{
+ Baz baz;
+
+ Bar func_1(const Bar & bar) {
+ if (Foo_eq(bar.a, baz.a.a) && bar.b == baz.a.b || some_other_function ())
+ return bar;
+ }
+
+ void func_2(const Baz & baz) {
+ func_1(baz.a);
+ some_function(__PRETTY_FUNCTION__);
+ }
+};
+
+void func() {
+ Bar bar;
+ Zonk *rep;
+ rep->func_1(bar);
+ rep->func_2(Baz(bar));
+}
+
+void foo ()
+{
+ func();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090302_0.C b/gcc/testsuite/g++.dg/lto/20090302_0.C
new file mode 100644
index 000000000..76de7baf0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090302_0.C
@@ -0,0 +1,9 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fPIC -flto -flto-partition=1to1 -r -nostdlib}} } */
+struct Foo {
+ bool Mumble();
+ static void Bar() { if (foo_->Mumble()) foo_ = 0; }
+ static void Baz() { Bar(); }
+ static Foo *foo_;
+};
+void Unused() { Foo::Bar(); Foo::Baz(); }
diff --git a/gcc/testsuite/g++.dg/lto/20090302_1.C b/gcc/testsuite/g++.dg/lto/20090302_1.C
new file mode 100644
index 000000000..0ccaf3c82
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090302_1.C
@@ -0,0 +1,7 @@
+struct Foo {
+ bool Mumble();
+ static void Bar() { if (foo_->Mumble()) foo_ = 0; }
+ static void Baz() { Bar(); }
+ static Foo *foo_;
+};
+Foo *Foo::foo_;
diff --git a/gcc/testsuite/g++.dg/lto/20090303_0.C b/gcc/testsuite/g++.dg/lto/20090303_0.C
new file mode 100644
index 000000000..36c8588bb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090303_0.C
@@ -0,0 +1,23 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options {{-flto -flto-partition=1to1 -fPIC}} } */
+/* { dg-lto-options {{-flto -flto-partition=1to1}} { target sparc*-*-* } } */
+/* { dg-suppress-ld-options {-fPIC} } */
+void foobar(int *, int* __x) ;
+int test_ints[30];
+int j;
+
+void foobar (int *x, int *y)
+{
+ *x = *y = 0;
+}
+
+void Test() {
+ int int_set_;
+ foobar (&int_set_, &test_ints[j]);
+}
+main()
+{
+ Test();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20090311-1.h b/gcc/testsuite/g++.dg/lto/20090311-1.h
new file mode 100644
index 000000000..389d94f00
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311-1.h
@@ -0,0 +1,22 @@
+typedef unsigned long uint32;
+typedef int JSIntn;
+#define JS_DLL_CALLBACK
+typedef JSIntn JSBool;
+typedef struct JSContext JSContext;
+typedef struct JSObject JSObject;
+typedef long long JSInt64;
+typedef JSInt64 JSWord;
+typedef JSWord jsword;
+typedef jsword jsval;
+
+typedef JSBool
+(* JS_DLL_CALLBACK JSPropertyOp)(JSContext *cx, JSObject *ojb, jsval id,
+ jsval *vp);
+
+struct JSClass {
+ const char *name;
+ uint32 flags;
+ JSPropertyOp addProperty;
+};
+
+extern struct JSClass K;
diff --git a/gcc/testsuite/g++.dg/lto/20090311-1_0.C b/gcc/testsuite/g++.dg/lto/20090311-1_0.C
new file mode 100644
index 000000000..6d4032724
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311-1_0.C
@@ -0,0 +1,34 @@
+/* { dg-lto-do run } */
+#include "20090311-1.h"
+bool flag;
+
+struct B {
+ int a;
+ enum { ANOTHER, ONE } f2_;
+ float c;
+};
+
+extern struct B x[];
+
+struct C {
+ int x;
+ struct B *p;
+ float d;
+};
+
+C c = { 0, 0, 3.4 };
+
+struct A {
+ enum { UNO, DOS, TRES } f1_;
+ int x;
+};
+
+A a;
+
+extern int foo();
+main()
+{
+ a.x = 4 + c.x;
+ foo();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090311-1_1.C b/gcc/testsuite/g++.dg/lto/20090311-1_1.C
new file mode 100644
index 000000000..520aa957a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311-1_1.C
@@ -0,0 +1,28 @@
+#include "20090311-1.h"
+
+struct A {
+ enum { UNO, DOS, TRES } f1_;
+ int x;
+};
+
+struct B;
+
+extern struct B x[];
+
+struct C {
+ int x;
+ struct B *p;
+ float d;
+};
+
+extern A a;
+extern B b;
+extern bool flag;
+extern C c;
+
+int foo()
+{
+ if (!flag)
+ return a.x - c.x;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090311_0.C b/gcc/testsuite/g++.dg/lto/20090311_0.C
new file mode 100644
index 000000000..cc54bbfdc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311_0.C
@@ -0,0 +1,13 @@
+class C1 {
+public: virtual ~C1() {
+}
+};
+class C2 : public C1 {
+public:
+ C2(void *q);
+ virtual void A();
+};
+int main(int argc, char **argv) {
+ C2 h(0);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090311_1.C b/gcc/testsuite/g++.dg/lto/20090311_1.C
new file mode 100644
index 000000000..e78da7223
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311_1.C
@@ -0,0 +1,13 @@
+class C1 {
+public: virtual ~C1() {
+}
+};
+class C2 : public C1 {
+ C2(void *q);
+ virtual void A();
+};
+void C2::A() {
+}
+C2::C2(void *q)
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090312.h b/gcc/testsuite/g++.dg/lto/20090312.h
new file mode 100644
index 000000000..c902e93c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090312.h
@@ -0,0 +1,2 @@
+enum Values { ONE, TWO, THREE };
+typedef const char * (* JSErrorCallback)(void *, const char *, const int);
diff --git a/gcc/testsuite/g++.dg/lto/20090312_0.C b/gcc/testsuite/g++.dg/lto/20090312_0.C
new file mode 100644
index 000000000..b2222c2aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090312_0.C
@@ -0,0 +1,14 @@
+#include "20090312.h"
+
+extern "C" {
+ extern enum Values x;
+ extern JSErrorCallback p;
+};
+
+main()
+{
+ if ( x == ONE && p == 0)
+ return 0;
+
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090312_1.C b/gcc/testsuite/g++.dg/lto/20090312_1.C
new file mode 100644
index 000000000..a0f9085f5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090312_1.C
@@ -0,0 +1,21 @@
+#include "20090312.h"
+
+/* This file should be compiled with the C front end. This
+ should be testing what happens when LTO merges enum types and function
+ prototypes compiled by the C and C++ FEs. Since both FEs generate
+ slightly different representations for these, LTO was emitting an
+ ODR violation error.
+
+ Once dejagnu can deal with multiple languages in a single test, remove
+ the __cplusplus checks and force this file to be compiled with the
+ C front end. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JSErrorCallback p = 0;
+enum Values x = ONE;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/lto/20090313_0.C b/gcc/testsuite/g++.dg/lto/20090313_0.C
new file mode 100644
index 000000000..70029e651
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090313_0.C
@@ -0,0 +1,5 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -flto-partition=1to1 -fPIC}} }
+// { dg-extra-ld-options "-flto -flto-partition=1to1 -r -nostdlib" }
+
+int X;
diff --git a/gcc/testsuite/g++.dg/lto/20090313_1.C b/gcc/testsuite/g++.dg/lto/20090313_1.C
new file mode 100644
index 000000000..088792b2d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090313_1.C
@@ -0,0 +1,12 @@
+struct Foo {
+ virtual void X();
+ virtual void Y();
+};
+struct Bar: public Foo {
+ Bar(Foo *);
+ void Y();
+};
+void Baz() {
+ Foo f;
+ Bar b(&f);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090315_0.C b/gcc/testsuite/g++.dg/lto/20090315_0.C
new file mode 100644
index 000000000..930fb16e5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090315_0.C
@@ -0,0 +1,9 @@
+// { dg-lto-do run }
+struct Foo {
+ bool Mumble() { return true; }
+ static void Bar() { if (foo_->Mumble()) foo_ = 0; }
+ static void Baz() { Bar(); }
+ static Foo *foo_;
+};
+Foo *Foo::foo_;
+main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20090315_1.C b/gcc/testsuite/g++.dg/lto/20090315_1.C
new file mode 100644
index 000000000..0a2fba552
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090315_1.C
@@ -0,0 +1,7 @@
+struct Foo {
+ bool Mumble() { return true; }
+ static void Bar() { if (foo_->Mumble()) foo_ = 0; }
+ static void Baz() { Bar(); }
+ static Foo *foo_;
+};
+void Unused() { Foo::Bar(); Foo::Baz(); }
diff --git a/gcc/testsuite/g++.dg/lto/20091002-1_0.C b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
new file mode 100644
index 000000000..050211ac3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
@@ -0,0 +1,58 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC -flto}} }
+// { dg-extra-ld-options "-fPIC -r -nostdlib" }
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template<class _CharT> struct char_traits;
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ostream;
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class istreambuf_iterator;
+ typedef basic_ostream<char> ostream;
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class num_get;
+ class locale {
+ class facet;
+ };
+ class locale::facet {
+ };
+ enum _Ios_Iostate { _S_beg = 0, _S_cur = 1, _S_end = 2,
+ _S_ios_seekdir_end = 1L << 16 };
+ class ios_base {
+ public:
+ typedef _Ios_Iostate iostate;
+ };
+ template<typename _CharT, typename _InIter>
+ class num_get : public locale::facet {
+ typedef _InIter iter_type;
+ template<typename _ValueT> iter_type
+ _M_extract_int(iter_type, iter_type, ios_base&,
+ ios_base::iostate&, _ValueT&) const;
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
+ };
+ extern template class num_get<char>;
+ template<typename _CharT, typename _Traits>
+ class basic_ios : public ios_base {
+ typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
+ __num_get_type;
+ const __num_get_type* _M_num_get;
+ };
+ template<typename _CharT, typename _Traits>
+ class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+ public:
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ __ostream_type& operator<<(double __f) { }
+ };
+ typedef double Real;
+ class Vector {
+ public:
+ Real operator[](int n) const { }
+ };
+ std::ostream& operator<<(std::ostream& s, const Vector& vec)
+ {
+ int i;
+ s << vec[i] << ')';
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20091002-2_0.C b/gcc/testsuite/g++.dg/lto/20091002-2_0.C
new file mode 100644
index 000000000..c150e977d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091002-2_0.C
@@ -0,0 +1,20 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC}} }
+// { dg-extra-ld-options "-fPIC -r -nostdlib" }
+
+class DataArray {
+ int max() const { }
+};
+template < class HashItem >
+class DataHashTable {
+ template < class ElemHashItem >
+ class Element { };
+ typedef Element< HashItem > Elem;
+ DataArray m_elem;
+};
+class Name { };
+class NameSet {
+ DataHashTable < Name > hashtab;
+};
+NameSet p;
+
diff --git a/gcc/testsuite/g++.dg/lto/20091002-3_0.C b/gcc/testsuite/g++.dg/lto/20091002-3_0.C
new file mode 100644
index 000000000..3c77f4b59
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091002-3_0.C
@@ -0,0 +1,15 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC}} }
+// { dg-extra-ld-options "-fPIC -r -nostdlib" }
+
+template < class T >
+class DataArray {
+ int max() const { }
+};
+class Name { };
+class DataHashTable {
+ template < class ElemHashItem > class Element { };
+ DataArray < Element < Name > > m_elem;
+};
+DataHashTable p;
+
diff --git a/gcc/testsuite/g++.dg/lto/20091004-1_0.C b/gcc/testsuite/g++.dg/lto/20091004-1_0.C
new file mode 100644
index 000000000..d65cf29ff
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091004-1_0.C
@@ -0,0 +1,35 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC -O -flto}} }
+
+typedef double Real;
+class Vector {
+ int dimen;
+ Real* val;
+public:
+ Vector& operator=(const Vector& vec);
+ Vector(int p_dimen, Real *p_val)
+ : dimen(p_dimen), val(p_val) { }
+ int dim() const;
+};
+class DVector : public Vector {
+public:
+ void reDim(int newdim);
+ explicit DVector(const Vector& old);
+ DVector& operator=(const Vector& vec) {
+ reDim(vec.dim());
+ Vector::operator=(vec);
+ }
+};
+Vector& Vector::operator=(const Vector& vec)
+{
+ dimen = vec.dimen;
+ val = vec.val;
+}
+int Vector::dim() const { return dimen; }
+DVector::DVector(const Vector& old) : Vector(0, 0)
+{
+ *this = old;
+}
+void DVector::reDim(int newdim) {}
+int main() {}
+
diff --git a/gcc/testsuite/g++.dg/lto/20091004-1_1.C b/gcc/testsuite/g++.dg/lto/20091004-1_1.C
new file mode 100644
index 000000000..0328abaae
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091004-1_1.C
@@ -0,0 +1,26 @@
+typedef double Real;
+class Vector {
+ int dimen;
+ Real* val;
+public:
+ Vector& operator=(const Vector& vec);
+ Vector(int p_dimen, Real *p_val)
+ : dimen(p_dimen), val(p_val) { }
+ int dim() const;
+};
+class DVector : public Vector {
+public:
+ void reDim(int newdim);
+ explicit DVector(const Vector& old);
+ DVector& operator=(const Vector& vec) {
+ reDim(vec.dim());
+ Vector::operator=(vec);
+ }
+};
+class SLUFactor {
+ DVector vec;
+ void solveRight (Vector& x, const Vector& b);
+};
+void SLUFactor::solveRight (Vector& x, const Vector& b) {
+ vec = b;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20091004-2_0.C b/gcc/testsuite/g++.dg/lto/20091004-2_0.C
new file mode 100644
index 000000000..321e50bc2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091004-2_0.C
@@ -0,0 +1,29 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC -O -flto}} }
+
+typedef double Real;
+class Vector {
+ int dimen;
+ Real* val;
+public:
+ Vector& operator=(const Vector& vec);
+ Vector(int p_dimen, Real *p_val)
+ : dimen(p_dimen), val(p_val) { }
+ int dim() const;
+};
+class DVector : public Vector {
+public:
+ void reDim(int newdim);
+ explicit DVector(const Vector& old);
+ DVector& operator=(const Vector& vec) {
+ reDim(vec.dim());
+ Vector::operator=(vec);
+ }
+};
+class SLUFactor {
+ DVector vec;
+ void solveRight (Vector& x, const Vector& b);
+};
+void SLUFactor::solveRight (Vector& x, const Vector& b) {
+ vec = b;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20091004-2_1.C b/gcc/testsuite/g++.dg/lto/20091004-2_1.C
new file mode 100644
index 000000000..9bbcd51f7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091004-2_1.C
@@ -0,0 +1,32 @@
+typedef double Real;
+class Vector {
+ int dimen;
+ Real* val;
+public:
+ Vector& operator=(const Vector& vec);
+ Vector(int p_dimen, Real *p_val)
+ : dimen(p_dimen), val(p_val) { }
+ int dim() const;
+};
+class DVector : public Vector {
+public:
+ void reDim(int newdim);
+ explicit DVector(const Vector& old);
+ DVector& operator=(const Vector& vec) {
+ reDim(vec.dim());
+ Vector::operator=(vec);
+ }
+};
+Vector& Vector::operator=(const Vector& vec)
+{
+ dimen = vec.dimen;
+ val = vec.val;
+}
+int Vector::dim() const { return dimen; }
+DVector::DVector(const Vector& old) : Vector(0, 0)
+{
+ *this = old;
+}
+void DVector::reDim(int newdim) {}
+int main() {}
+
diff --git a/gcc/testsuite/g++.dg/lto/20091004-3_0.C b/gcc/testsuite/g++.dg/lto/20091004-3_0.C
new file mode 100644
index 000000000..124eea5e4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091004-3_0.C
@@ -0,0 +1,18 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-O -flto}} }
+
+extern "C" double sqrt (double __x) throw ();
+typedef double VECTOR[3];
+enum { X = 0, Y = 1, Z = 2, T = 3 };
+inline void VLength(double& a, const VECTOR b)
+{
+ a = sqrt(b[X] * b[X] + b[Y] * b[Y] + b[Z] * b[Z]);
+}
+void
+determine_subpatch_flatness(void)
+{
+ double temp1;
+ VECTOR TempV;
+ VLength(temp1, TempV);
+ VLength(temp1, TempV);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20091004-3_1.C b/gcc/testsuite/g++.dg/lto/20091004-3_1.C
new file mode 100644
index 000000000..641c7495b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091004-3_1.C
@@ -0,0 +1,16 @@
+extern "C" double sqrt (double __x) throw ();
+typedef double VECTOR[3];
+enum { X = 0, Y = 1, Z = 2, T = 3 };
+inline void VLength(double& a, const VECTOR b)
+{
+ a = sqrt(b[X] * b[X] + b[Y] * b[Y] + b[Z] * b[Z]);
+}
+int
+All_Torus_Intersections(void)
+{
+ double len;
+ VECTOR D;
+ VLength(len, D);
+ VLength(len, D);
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20091022-1_0.C b/gcc/testsuite/g++.dg/lto/20091022-1_0.C
new file mode 100644
index 000000000..cb3f20a4e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091022-1_0.C
@@ -0,0 +1,13 @@
+// { dg-lto-do link }
+// { dg-extra-ld-options "-fwhole-program" }
+
+template <int dim>
+struct AutoDerivativeFunction {
+ virtual void gradient_list (void);
+};
+template <int dim>
+void AutoDerivativeFunction<dim>::gradient_list (void)
+{
+}
+template class AutoDerivativeFunction<1>;
+int main() {}
diff --git a/gcc/testsuite/g++.dg/lto/20091022-2_0.C b/gcc/testsuite/g++.dg/lto/20091022-2_0.C
new file mode 100644
index 000000000..29ed9b6b0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091022-2_0.C
@@ -0,0 +1,12 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-O3 -flto -Winline}} }
+
+#include <string>
+
+int
+main()
+{
+ std::string i;
+ i = "abc";
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_0.C b/gcc/testsuite/g++.dg/lto/20091026-1_0.C
new file mode 100644
index 000000000..5c74f29cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091026-1_0.C
@@ -0,0 +1,11 @@
+// { dg-lto-do link }
+// { dg-extra-ld-options "-r -nostdlib" }
+
+#include "20091026-1_a.h"
+cObject *cHead::find(const char *objname) const
+{
+ return firstchildp;
+}
+class cNetworkType : public cObject { };
+cNetworkType *networktype;
+
diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_1.C b/gcc/testsuite/g++.dg/lto/20091026-1_1.C
new file mode 100644
index 000000000..28816100e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091026-1_1.C
@@ -0,0 +1,14 @@
+#include "20091026-1_a.h"
+extern cHead networks;
+class cNetworkType;
+inline cNetworkType *findNetwork(const char *s)
+{
+ return (cNetworkType *)networks.find(s);
+}
+int run(const char *opt_network_name)
+{
+ cNetworkType *network = findNetwork(opt_network_name);
+ if (!network)
+ throw 1;
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_a.h b/gcc/testsuite/g++.dg/lto/20091026-1_a.h
new file mode 100644
index 000000000..314dd9610
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091026-1_a.h
@@ -0,0 +1,9 @@
+class cObject {
+public:
+ cObject *firstchildp;
+};
+class cHead : public cObject {
+public:
+ cObject *find(const char *objname) const;
+};
+
diff --git a/gcc/testsuite/g++.dg/lto/20091210-1_0.C b/gcc/testsuite/g++.dg/lto/20091210-1_0.C
new file mode 100644
index 000000000..3bdfd9d56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091210-1_0.C
@@ -0,0 +1,3 @@
+// { dg-lto-do link }
+#include "20091210-1_0.h"
+void Base::f() {}
diff --git a/gcc/testsuite/g++.dg/lto/20091210-1_0.h b/gcc/testsuite/g++.dg/lto/20091210-1_0.h
new file mode 100644
index 000000000..a46f3c2db
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091210-1_0.h
@@ -0,0 +1,9 @@
+struct Base1 {
+ virtual ~Base1() {}
+};
+struct Base2 {
+ virtual void f() = 0;
+};
+struct Base : Base1, Base2 {
+ virtual void f();
+};
diff --git a/gcc/testsuite/g++.dg/lto/20091210-1_1.C b/gcc/testsuite/g++.dg/lto/20091210-1_1.C
new file mode 100644
index 000000000..4fb15cd5f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091210-1_1.C
@@ -0,0 +1,9 @@
+#include "20091210-1_0.h"
+
+struct Foo : Base {
+ virtual void g();
+};
+
+void Foo::g() {}
+
+int main() {}
diff --git a/gcc/testsuite/g++.dg/lto/20091219_0.C b/gcc/testsuite/g++.dg/lto/20091219_0.C
new file mode 100644
index 000000000..b76a95a9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091219_0.C
@@ -0,0 +1,17 @@
+// { dg-lto-do run }
+// { dg-lto-options {{-O3 -flto}} }
+
+#include <string>
+#include <map>
+
+int main ()
+{
+ typedef std::map<int, std::string> Map;
+ static Map m;
+
+ Map::const_iterator it = m.find(0);
+ if (it != m.end())
+ std::string s = it->second;
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20100302.h b/gcc/testsuite/g++.dg/lto/20100302.h
new file mode 100644
index 000000000..7260be10c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100302.h
@@ -0,0 +1,9 @@
+typedef float mm128 __attribute ((vector_size (16)));
+
+template <class T>
+struct A
+{
+ static T t;
+};
+
+void f (mm128 *);
diff --git a/gcc/testsuite/g++.dg/lto/20100302_0.C b/gcc/testsuite/g++.dg/lto/20100302_0.C
new file mode 100644
index 000000000..0551e6ebc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100302_0.C
@@ -0,0 +1,9 @@
+// Test for ABI forward-compatibility aliases with LTO.
+// { dg-skip-if "" { { ! { i?86-*-* x86_64-*-* } } || { *-*-darwin* } } { "*" } { "" } }
+// { dg-lto-options {"-flto -fabi-version=2"} }
+
+#include "20100302.h"
+
+void f(mm128 *) { }
+
+template <> mm128 A<mm128>::t = { };
diff --git a/gcc/testsuite/g++.dg/lto/20100302_1.C b/gcc/testsuite/g++.dg/lto/20100302_1.C
new file mode 100644
index 000000000..48548b63a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100302_1.C
@@ -0,0 +1,8 @@
+// { dg-options "-fabi-version=0" }
+
+#include "20100302.h"
+
+int main()
+{
+ f(& A<mm128>::t);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20100423-1_0.C b/gcc/testsuite/g++.dg/lto/20100423-1_0.C
new file mode 100644
index 000000000..f6a741dad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100423-1_0.C
@@ -0,0 +1,38 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-g -flto}} }
+
+namespace llvm
+{
+ class Function;
+ class MachineCodeInfo;
+ class ExecutionEngine
+ {
+ };
+ class JIT : public ExecutionEngine
+ {
+ void runJITOnFunction (Function * F, MachineCodeInfo * MCI = 0);
+ };
+ class JITEventListener
+ {
+ public:
+ JITEventListener ()
+ {
+ }
+ virtual ~JITEventListener ();
+ };
+}
+
+using namespace llvm;
+void
+JIT::runJITOnFunction (Function * F, MachineCodeInfo * MCI)
+{
+ class MCIListener:public JITEventListener
+ {
+ MachineCodeInfo *const MCI;
+ public:
+ MCIListener (MachineCodeInfo * mci):MCI (mci)
+ {
+ }
+ };
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20100423-2_0.C b/gcc/testsuite/g++.dg/lto/20100423-2_0.C
new file mode 100644
index 000000000..2ab6bdc56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100423-2_0.C
@@ -0,0 +1,14 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-flto -g}} }
+
+struct A
+{
+ virtual ~A();
+};
+
+void foo()
+{
+ struct B : A {};
+ B b;
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20100423-3_0.C b/gcc/testsuite/g++.dg/lto/20100423-3_0.C
new file mode 100644
index 000000000..49564a586
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100423-3_0.C
@@ -0,0 +1,14 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-flto -g}} }
+
+inline int foo()
+{
+ static union { int i; };
+ return i;
+}
+
+void bar()
+{
+ foo();
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20100519-1_0.C b/gcc/testsuite/g++.dg/lto/20100519-1_0.C
new file mode 100644
index 000000000..bc2ddf140
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100519-1_0.C
@@ -0,0 +1,23 @@
+// { dg-lto-do link }
+
+template <typename Ordinal>
+struct DirectSerializationTraits
+{
+ static void fromCountToDirectBytes(const Ordinal count) {}
+};
+template<typename Ordinal> class SerializationTraits
+ : public DirectSerializationTraits<Ordinal> { };
+template <typename Ordinal>
+class ConstValueTypeSerializationBuffer
+{
+public:
+ ConstValueTypeSerializationBuffer(const Ordinal count)
+ {
+ typedef SerializationTraits<Ordinal> SerT;
+ SerT::fromCountToDirectBytes(count);
+ }
+};
+int main ()
+{
+ ConstValueTypeSerializationBuffer<int> charSendBuffer(1);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20100603-1_0.C b/gcc/testsuite/g++.dg/lto/20100603-1_0.C
new file mode 100644
index 000000000..8fe11a2f1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100603-1_0.C
@@ -0,0 +1,14 @@
+/* { dg-lto-do link } */
+
+extern "C" {
+ typedef struct {} CvImage;
+ extern CvImage* Cv_ImageNew(void);
+}
+void __attribute__((noinline,noclone))
+_Raytrace(CvImage* LImage) { __asm volatile (""); }
+int main(int LArgC, char** LArgV)
+{
+ CvImage* LImage = Cv_ImageNew();
+ _Raytrace(LImage);
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20100603-1_1.c b/gcc/testsuite/g++.dg/lto/20100603-1_1.c
new file mode 100644
index 000000000..fddce5d4b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100603-1_1.c
@@ -0,0 +1,2 @@
+typedef struct {} CvImage;
+CvImage* Cv_ImageNew(void) { }
diff --git a/gcc/testsuite/g++.dg/lto/20100721-1_0.C b/gcc/testsuite/g++.dg/lto/20100721-1_0.C
new file mode 100644
index 000000000..09132e599
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100721-1_0.C
@@ -0,0 +1,9 @@
+/* { dg-lto-do assemble } */
+
+static inline int __gthread_active_p (void) { }
+template <int rank, int dim> class Tensor;
+template <int dimension> struct G;
+template <int dim> class T {
+ typedef void A;
+ typedef Tensor<1,dim> F[G<dim>::v];
+};
diff --git a/gcc/testsuite/g++.dg/lto/20100722-1_0.C b/gcc/testsuite/g++.dg/lto/20100722-1_0.C
new file mode 100644
index 000000000..72393950d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100722-1_0.C
@@ -0,0 +1,5 @@
+/* { dg-lto-do assemble } */
+
+template <class T> void void_cast_register(T *) __attribute__ ((used));
+template <class T> void void_cast_register(T *) { }
+
diff --git a/gcc/testsuite/g++.dg/lto/20100723-1_0.C b/gcc/testsuite/g++.dg/lto/20100723-1_0.C
new file mode 100644
index 000000000..d39963593
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100723-1_0.C
@@ -0,0 +1,12 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fcompare-debug -flto -flto-partition=none} {-fcompare-debug -flto -flto-partition=1to1}} } */
+
+struct S {
+ virtual void f() { }
+};
+
+int main(int, char *[])
+{
+ S s;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20100724-1_0.C b/gcc/testsuite/g++.dg/lto/20100724-1_0.C
new file mode 100644
index 000000000..084c07f08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20100724-1_0.C
@@ -0,0 +1,7 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-ftoplevel-reorder -flto -flto-partition=none} {-ftoplevel-reorder -flto -flto-partition=1to1}} } */
+/* { dg-extra-ld-options {-r -nostdlib} } */
+
+struct Foo { virtual ~Foo(); };
+struct Bar:public Foo { Bar() { } };
+void Func() { new Bar(); }
diff --git a/gcc/testsuite/g++.dg/lto/20101009-1_0.C b/gcc/testsuite/g++.dg/lto/20101009-1_0.C
new file mode 100644
index 000000000..b7cc5bc47
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101009-1_0.C
@@ -0,0 +1,14 @@
+// { dg-lto-do link }
+
+template < typename > struct X
+{
+ template < typename > static int test ();
+ static const int i = sizeof (test < int >());
+};
+
+template struct X < int >;
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20101010-1_0.C b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
new file mode 100644
index 000000000..6eb40efc8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101010-1_0.C
@@ -0,0 +1,109 @@
+// { dg-lto-do link }
+
+typedef long size_t;
+template < class, class > struct pair
+{
+}
+;
+template < typename > class allocator;
+template < typename > struct equal_to;
+
+template < class > struct hash;
+template
+<
+class, class, class, class, class, class > struct dense_hashtable_iterator;
+template
+<
+class,
+ class, class, class, class, class > struct dense_hashtable_const_iterator;
+template
+<
+class
+Value,
+ class
+ Key,
+ class
+ HashFcn,
+ class ExtractKey, class EqualKey, class Alloc > class dense_hashtable
+{
+public:
+ typedef Key key_type;
+ typedef Value value_type;
+ typedef size_t size_type;
+ typedef
+ dense_hashtable_iterator
+ < Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > iterator;
+ typedef
+ dense_hashtable_const_iterator
+ < Value, Key, HashFcn, ExtractKey, EqualKey, Alloc > const_iterator;
+ static const size_type ILLEGAL_BUCKET = (-1);
+ pair < size_type, size_type > find_position (key_type)
+ {
+ size_type insert_pos = ILLEGAL_BUCKET;
+ }
+ pair < iterator, bool > insert_noresize (value_type obj)
+ {
+ pair < size_type, size_type > pos = find_position ((obj));
+ }
+ pair < iterator, bool > insert (value_type & obj)
+ {
+ insert_noresize (obj);
+ }
+ ExtractKey get_key;
+}
+
+;
+template
+<
+class
+Value,
+ class
+ HashFcn
+ =
+ hash
+ <
+ Value
+ >,
+ class
+ EqualKey
+ =
+ equal_to < Value >, class Alloc = allocator < Value > >class dense_hash_set
+{
+ struct Identity
+ {
+ }
+ ;
+ typedef
+ dense_hashtable < Value, Value, HashFcn, Identity, EqualKey, Alloc > ht;
+ ht rep;
+public:
+ typedef typename ht::value_type value_type;
+ typedef typename ht::const_iterator iterator;
+ pair < iterator, bool > insert (value_type obj)
+ {
+ pair < typename ht::iterator, bool > p = rep.insert (obj);
+ }
+}
+
+;
+class blah_46
+{
+}
+;
+struct foo_10:dense_hash_set < blah_46 >
+{
+}
+;
+class foo_14
+{
+ void hmmmmh_5 (blah_46);
+ foo_10 negative_rrrrrrr_type_data_;
+}
+;
+void
+foo_14::hmmmmh_5 (blah_46 hahaha_id)
+{
+ negative_rrrrrrr_type_data_.insert (hahaha_id);
+}
+
+int main () { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20101010-2_0.C b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
new file mode 100644
index 000000000..c68bcd632
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101010-2_0.C
@@ -0,0 +1,32 @@
+// { dg-lto-do link }
+
+typedef int size_t;
+template < size_t _Nw > struct _Base_bitset
+{
+ typedef unsigned _WordT;
+ _WordT _M_w[_Nw];
+ void _M_do_set ()
+ {
+ for (size_t __i;;)
+ _M_w[__i] = static_cast < _WordT > (0);
+ }
+};
+
+template < size_t > class bitset:
+_Base_bitset < ((sizeof (unsigned)) + ((sizeof (unsigned)) ? : 1)) >
+{
+public:
+ bitset set ()
+ {
+ _M_do_set ();
+ }
+};
+
+void
+test01 ()
+{
+ bitset < 96 > z6;
+ z6.set ();
+}
+
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20101010-3_0.C b/gcc/testsuite/g++.dg/lto/20101010-3_0.C
new file mode 100644
index 000000000..ed3b8d6bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101010-3_0.C
@@ -0,0 +1,5 @@
+// { dg-lto-do link }
+// { dg-lto-options { "-flto -std=c++0x" } }
+
+decltype(nullptr) a;
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20101010-4_0.C b/gcc/testsuite/g++.dg/lto/20101010-4_0.C
new file mode 100644
index 000000000..01beb2167
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101010-4_0.C
@@ -0,0 +1,9 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -std=c++0x -flto -r -nostdlib } { -std=c++0x -flto -g -r -nostdlib } } }
+
+typedef decltype(nullptr) nullptr_t;
+class shared_ptr {
+public:
+ shared_ptr(nullptr_t __p);
+};
+shared_ptr p = nullptr;
diff --git a/gcc/testsuite/g++.dg/lto/20101014-1_0.C b/gcc/testsuite/g++.dg/lto/20101014-1_0.C
new file mode 100644
index 000000000..d2f599e40
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101014-1_0.C
@@ -0,0 +1,16 @@
+// { dg-lto-do run }
+
+static const char *fname;
+struct S
+{
+ S () { fname = __func__; }
+};
+extern "C" void abort (void);
+int
+main ()
+{
+ S tmp;
+ if (fname[0] != 'S')
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20101014-2_0.C b/gcc/testsuite/g++.dg/lto/20101014-2_0.C
new file mode 100644
index 000000000..0b2a52c61
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101014-2_0.C
@@ -0,0 +1,8 @@
+// { dg-lto-do assemble }
+
+template<class T, unsigned long l>
+inline unsigned long foo (T (&)[l]) { return l; }
+
+struct S { char *s[4]; S (); };
+
+S::S () { typedef int T[foo (s) == 4 ? 1 : -1]; }
diff --git a/gcc/testsuite/g++.dg/lto/20101015-1_0.C b/gcc/testsuite/g++.dg/lto/20101015-1_0.C
new file mode 100644
index 000000000..a3b296ee0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101015-1_0.C
@@ -0,0 +1,31 @@
+// { dg-lto-do assemble }
+
+class DOMString { };
+class DocumentImpl;
+class NodeImpl {
+public:
+ static const DOMString&
+ mapPrefix(const DOMString &prefix, const DOMString &namespaceURI, short nType);
+ static DOMString getXmlnsURIString();
+};
+class DOM_Node {
+public:
+ enum NodeType { ATTRIBUTE_NODE = 2 };
+};
+class AttrImpl: public NodeImpl {
+public:
+ AttrImpl(DocumentImpl *ownerDocument, const DOMString &aName);
+};
+class AttrNSImpl: public AttrImpl {
+ AttrNSImpl(DocumentImpl *ownerDoc, const DOMString &namespaceURI, const DOMString &qualifiedName);
+};
+AttrNSImpl::AttrNSImpl(DocumentImpl *ownerDoc,
+ const DOMString &fNamespaceURI,
+ const DOMString &qualifiedName)
+ : AttrImpl(ownerDoc, qualifiedName)
+{
+ DOMString xmlnsURI = NodeImpl::getXmlnsURIString();
+ DOMString prefix;
+ bool xmlnsAlone = false;
+ const DOMString& URI = xmlnsAlone ? xmlnsURI : mapPrefix(prefix, fNamespaceURI, DOM_Node::ATTRIBUTE_NODE);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20101015-2_0.C b/gcc/testsuite/g++.dg/lto/20101015-2_0.C
new file mode 100644
index 000000000..9015f53a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101015-2_0.C
@@ -0,0 +1,6 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto } { -g -flto } } }
+// { dg-extra-ld-options "-r -nostdlib" }
+
+struct Base { ~Base (); };
+void fun(void) { struct Deriv : Base { } x; }
diff --git a/gcc/testsuite/g++.dg/lto/20101020-1_0.C b/gcc/testsuite/g++.dg/lto/20101020-1_0.C
new file mode 100644
index 000000000..e92bcf8ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101020-1_0.C
@@ -0,0 +1,8 @@
+// { dg-lto-do link }
+
+#include "20101020-1_0.h"
+A::A ()
+{
+ foo (&A::bar);
+}
+int main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20101020-1_0.h b/gcc/testsuite/g++.dg/lto/20101020-1_0.h
new file mode 100644
index 000000000..2de1d3c76
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101020-1_0.h
@@ -0,0 +1,23 @@
+struct A;
+typedef void (A::*Am1) (void *);
+typedef void (A::*Am2) ();
+
+struct B
+{
+ Am2 am2;
+};
+
+struct A
+{
+ A ();
+ struct B b;
+ struct C *c;
+ struct D *d;
+ void foo (Am1);
+ void bar (void *);
+};
+
+struct C
+{
+};
+
diff --git a/gcc/testsuite/g++.dg/lto/20101020-1_1.C b/gcc/testsuite/g++.dg/lto/20101020-1_1.C
new file mode 100644
index 000000000..5c83fbfdb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101020-1_1.C
@@ -0,0 +1,11 @@
+#include "20101020-1_0.h"
+struct D
+{
+};
+void A::bar (void *)
+{
+}
+void A::foo (Am1)
+{
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20101126-1_0.C b/gcc/testsuite/g++.dg/lto/20101126-1_0.C
new file mode 100644
index 000000000..93a1cf3af
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101126-1_0.C
@@ -0,0 +1,5 @@
+typedef struct { int i; } T1;
+typedef T1 T2;
+extern T1 a;
+extern T2 b;
+int main() { return a.i + b.i; }
diff --git a/gcc/testsuite/g++.dg/lto/20101126-1_1.c b/gcc/testsuite/g++.dg/lto/20101126-1_1.c
new file mode 100644
index 000000000..628e89b6c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20101126-1_1.c
@@ -0,0 +1,4 @@
+typedef struct { int i; } T1;
+typedef T1 T2;
+T1 a;
+T2 b;
diff --git a/gcc/testsuite/g++.dg/lto/20110311-1_0.C b/gcc/testsuite/g++.dg/lto/20110311-1_0.C
new file mode 100644
index 000000000..c63951e5b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20110311-1_0.C
@@ -0,0 +1,51 @@
+/* { dg-lto-do link } */
+/* { dg-extra-ld-options "-r -nostdlib" } */
+
+struct NullType {};
+
+template <class T, class U>
+struct TList
+{
+ typedef T Head;
+ typedef U Tail;
+};
+
+template <class T>
+struct TListLength {};
+
+template <class T, class U>
+struct TListLength<TList<T,U> >
+{
+ enum
+ {
+ Ret = 1 + TListLength<U>::Ret
+ };
+};
+
+template <>
+struct TListLength<NullType>
+{
+ enum
+ {
+ Ret = 0
+ };
+};
+
+template <class Moves>
+class DDQMC
+{
+public:
+ int* moves[TListLength<Moves>::Ret];
+ inline DDQMC();
+private:
+};
+
+template <class Moves>
+DDQMC<Moves>::DDQMC()
+{
+}
+
+int main()
+{
+ typedef DDQMC< TList<float, TList<int, NullType> > > mytype;
+}
diff --git a/gcc/testsuite/g++.dg/lto/README b/gcc/testsuite/g++.dg/lto/README
new file mode 100644
index 000000000..5fa3123b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/README
@@ -0,0 +1,35 @@
+This directory contains tests for link-time optimization (LTO).
+Tests in this directory may span multiple files, so the naming of
+the files is significant.
+
+The name of every file must end with '_N' where N is an integer.
+All the files with the same name base and different _N suffixes
+will be compiled separately and linked together to form the final
+executable.
+
+By default, each set of files will be compiled with list of
+options listed in LTO_OPTIONS (../../lib/lto.exp), which can be
+overwritten in the shell environment or using the 'dg-lto-options'
+command in the main file of the set (i.e., the file with _0
+suffix).
+
+For example, given the files a_0.C a_1.C a_2.C, they will be
+compiled as:
+
+$ g++ -c <flags> a_0.C
+$ g++ -c <flags> a_1.C
+$ g++ -c <flags> a_2.C
+$ g++ -o <executable> a_0.o a_1.o a_2.o
+
+Tests that do not need more than one file are a special case
+where there is a single file named 'foo_0.C'.
+
+The only supported dg-lto-do option are 'compile', 'run' and 'link'.
+Additionally, these can only be used in the main file. If
+'compile' is used, only the individual object files are
+generated. If 'link' is used, the final executable is generated
+but not executed (in this case, function main() needs to exist
+but it does not need to do anything). If 'run' is used, the
+final executable is generated and the resulting binary executed.
+
+The default value for dg-lto-do is 'run'.
diff --git a/gcc/testsuite/g++.dg/lto/lto.exp b/gcc/testsuite/g++.dg/lto/lto.exp
new file mode 100644
index 000000000..62d825031
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/lto.exp
@@ -0,0 +1,60 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+#
+# Contributed by Diego Novillo <dnovillo@google.com>
+
+
+# Test link-time optimization across multiple files.
+#
+# Programs are broken into multiple files. Each one is compiled
+# separately with LTO information. The final executable is generated
+# by collecting all the generated object files using regular LTO or WHOPR.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Load procedures from common libraries.
+load_lib standard.exp
+load_lib g++.exp
+load_lib target-libpath.exp
+
+# Load the language-independent compabibility support procedures.
+load_lib lto.exp
+
+g++_init
+lto_init no-mathlib
+
+# Define an identifier for use with this suite to avoid name conflicts
+# with other lto tests running at the same time.
+set sid "cp_lto"
+
+# If LTO has not been enabled, bail.
+if { ![check_effective_target_lto] } {
+ return
+}
+
+# Main loop.
+foreach src [lsort [find $srcdir/$subdir *_0.C]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $src] then {
+ continue
+ }
+
+ lto-execute $src $sid
+}
+
+lto_finish
diff --git a/gcc/testsuite/g++.dg/lto/pr40818_0.C b/gcc/testsuite/g++.dg/lto/pr40818_0.C
new file mode 100644
index 000000000..8430f9cd0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr40818_0.C
@@ -0,0 +1,11 @@
+// { dg-lto-do assemble }
+// Test case from Eugene A. Strizhov.
+
+extern int i;
+struct S { S (); };
+
+S::S ()
+{
+ enum { fifty = 0x50 };
+ if (i > fifty);
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr45621.h b/gcc/testsuite/g++.dg/lto/pr45621.h
new file mode 100644
index 000000000..81a764225
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr45621.h
@@ -0,0 +1,8 @@
+struct S
+{
+ void m ();
+ virtual void v1 ();
+ virtual void v2 ();
+};
+
+extern S s;
diff --git a/gcc/testsuite/g++.dg/lto/pr45621_0.C b/gcc/testsuite/g++.dg/lto/pr45621_0.C
new file mode 100644
index 000000000..746079cdc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr45621_0.C
@@ -0,0 +1,10 @@
+// { dg-lto-do assemble }
+// { dg-extra-ld-options "-O2 -fipa-cp-clone -flto -nostdlib -r" }
+#include "pr45621.h"
+
+void
+foo ()
+{
+ s.v1 ();
+ s.m ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr45621_1.C b/gcc/testsuite/g++.dg/lto/pr45621_1.C
new file mode 100644
index 000000000..2ada6a879
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr45621_1.C
@@ -0,0 +1,13 @@
+#include "pr45621.h"
+
+void
+S::v1 ()
+{
+ v2 ();
+}
+
+void
+S::m ()
+{
+ v1 ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr45679-1_0.C b/gcc/testsuite/g++.dg/lto/pr45679-1_0.C
new file mode 100644
index 000000000..349f5c2c1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr45679-1_0.C
@@ -0,0 +1,28 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-O3 -Wno-multichar}} }
+// { dg-extra-ld-options "-flto -flto-partition=1to1 -r -nostdlib" }
+
+ extern "C" {
+ typedef struct __locale_struct {
+ }
+ *__locale_t;
+ }
+ typedef void * POVMSContext;
+ struct POVMSData {
+ };
+ int POVMS_OpenContext (POVMSContext *contextrefptr);
+ enum {
+ kPOVMsgIdent_InitInfo = 'InIn', kPOVMsgIdent_RenderOptions = 'ROpt', kPOVMsgIdent_RenderAll = 'RAll', kPOVMsgIdent_RenderArea = 'RAre', kPOVMsgIdent_RenderPause = 'RPau', kPOVMsgIdent_RenderStop = 'RSto', kPOVMsgIdent_RenderStarted = 'RRun', kPOVMsgIdent_RenderDone = 'REnd', kPOVMsgIdent_FrameStatistics = 'FSta', kPOVMsgIdent_ParseStatistics = 'PSta', kPOVMsgIdent_RenderStatistics = 'RSta', kPOVMsgIdent_Progress = 'Prog', kPOVMsgIdent_Warning = 'Warn', kPOVMsgIdent_Error = 'ErrW', kPOVMsgIdent_FatalError = 'ErrF', kPOVMsgIdent_Debug = 'Dbug' };
+ namespace pov {
+ }
+ using namespace pov;
+ namespace pov {
+ int pre_init_flag = 0;
+ }
+ POVMSContext POVMS_Render_Context = __null;
+ void povray_init() {
+ if (pre_init_flag == 0) {
+ int err;
+ err = POVMS_OpenContext(&POVMS_Render_Context);
+ }
+ }
diff --git a/gcc/testsuite/g++.dg/lto/pr45679-1_1.C b/gcc/testsuite/g++.dg/lto/pr45679-1_1.C
new file mode 100644
index 000000000..c5e2db061
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr45679-1_1.C
@@ -0,0 +1,77 @@
+ extern "C" {
+ typedef struct _IO_FILE FILE;
+ extern struct _IO_FILE *stderr;
+ extern int fprintf (FILE *__restrict __stream, __const char *__restrict __format, ...);
+ }
+ enum {
+ kPOVMSObjectClassID = 'OCLA', kPOVMSMessageClassID = 'MCLA', kPOVMSMessageIdentID = 'MIDE', kPOVMSSourceAddressID = 'MSRC', kPOVMSDestinationAddressID = 'MDST', kPOVMSMessageTimeoutID = 'TOUT', kPOVMSMessageErrorID = 'MERR' };
+ typedef void * POVMSContext;
+ typedef struct POVMSData POVMSObject, *POVMSObjectPtr;
+ typedef struct POVMSData POVMSAttribute, *POVMSAttributePtr;
+ struct POVMSData {
+ union {
+ struct POVMSNode *root;
+ };
+ };
+ struct POVMSNode {
+ struct POVMSNode *next;
+ unsigned int key;
+ struct POVMSData data;
+ };
+ int POVMSObject_New (POVMSObjectPtr object, unsigned int objclass);
+ int POVMSObject_Set (POVMSObjectPtr object, POVMSAttributePtr attr, unsigned int key);
+ int POVMSAttr_Copy (POVMSAttributePtr sourceattr, POVMSAttributePtr destattr);
+ int POVMSUtil_GetType (POVMSObjectPtr object, unsigned int key, unsigned int *typevalue);
+ namespace pov_base {
+ enum {
+ kNoError = 0, kNoErr = kNoError, kParamErr = -1, kMemFullErr = -2, kOutOfMemoryErr = kMemFullErr, kInvalidDataSizeErr = -3, kCannotHandleDataErr = -4, kNullPointerErr = -5, kChecksumErr = -6, kParseErr = -7, kCannotOpenFileErr = -8, kInvalidDestAddrErr = -9, kCannotConnectErr = -10, kDisconnectedErr = -11, kHostDisconnectedErr = -12, kNetworkDataErr = -13, kNetworkConnectionErr = -14, kObjectAccessErr = -15, kVersionErr = -16, kFileDataErr = -17, kAuthorisationErr = -18, kDataTypeErr = -19, kTimeoutErr = -20, kInvalidContextErr = -21 };
+ }
+ using namespace pov_base;
+ struct POVMSContextData {
+ };
+ int POVMS_AssertFunction (int cond, const char *str, const char *filename, int line);
+ int POVMS_OpenContext(POVMSContext *contextrefptr) {
+ POVMSContextData *context = __null;
+ if(contextrefptr == __null) return kParamErr;
+ if(POVMS_AssertFunction(context != __null, "POVMS_Open_Context failed, out of memory", "povms.cpp", 283) == false) return kMemFullErr;
+ return kNoErr;
+ }
+ int POVMS_AssertFunction(int cond, const char *str, const char *filename, int line) {
+ if(cond == false) {
+ fprintf(stderr, "POVMS_ASSERT failed in %s line %d: %s\n", filename, (int)line, str);
+ }
+ }
+ int POVMSObject_Copy(POVMSObjectPtr sourceobject, POVMSObjectPtr destobject) {
+ POVMSNode *cur = __null;
+ POVMSAttribute attr;
+ unsigned int t;
+ int ret = kNoErr;
+ if(sourceobject == destobject) return kParamErr;
+ if(POVMSUtil_GetType(sourceobject, kPOVMSObjectClassID, &t) != kNoErr) return kObjectAccessErr;
+ if(POVMSObject_New(destobject, t) != kNoErr) return kObjectAccessErr;
+ for(cur = sourceobject->root;
+ cur != __null;
+ cur = cur->next) {
+ if(POVMS_AssertFunction(POVMSAttr_Copy(&(cur->data), &attr) == kNoErr, "POVMSObject_Copy failed, out of memory", "povms.cpp", 2028) == false) {
+ }
+ if(POVMS_AssertFunction(POVMSObject_Set(destobject, &attr, cur->key) == kNoErr, "POVMSObject_Copy failed, out of memory", "povms.cpp", 2034) == false) {
+ }
+ }
+ return ret;
+ }
+ int POVMSObject_Merge(POVMSObjectPtr sourceobject, POVMSObjectPtr destobject) {
+ POVMSNode *cur = __null;
+ POVMSAttribute attr;
+ unsigned int t1, t2;
+ int ret = kNoErr;
+ if(destobject == __null) return kParamErr;
+ if(POVMSUtil_GetType(sourceobject, kPOVMSObjectClassID, &t1) != kNoErr) return kObjectAccessErr;
+ if(POVMSUtil_GetType(sourceobject, kPOVMSObjectClassID, &t2) != kNoErr) return kObjectAccessErr;
+ for(cur = sourceobject->root;
+ cur != __null;
+ cur = cur->next) {
+ if(POVMS_AssertFunction(POVMSObject_Set(destobject, &attr, cur->key) == kNoErr, "POVMSObject_Merge failed, out of memory", "povms.cpp", 2090) == false) {
+ }
+ }
+ return ret;
+ }
diff --git a/gcc/testsuite/g++.dg/lto/pr45679-2_0.C b/gcc/testsuite/g++.dg/lto/pr45679-2_0.C
new file mode 100644
index 000000000..549741902
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr45679-2_0.C
@@ -0,0 +1,119 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-O3 -Wno-multichar}} }
+// { dg-extra-ld-options "-flto -flto-partition=1to1 -r -nostdlib" }
+ extern "C" {
+ typedef struct {
+ union {
+ }
+ __value;
+ }
+ __mbstate_t;
+ struct _IO_marker {
+ };
+ extern "C" {
+ }
+ };
+ namespace pov_base {
+ class IOBase {
+ };
+ }
+ namespace pov {
+ typedef double VECTOR[3];
+ enum {
+ X = 0, Y = 1, Z = 2, T = 3 };
+ inline void Assign_Vector(VECTOR d, VECTOR s) {
+ }
+ typedef float BBOX_VAL;
+ typedef BBOX_VAL BBOX_VECT[3];
+ typedef struct Bounding_Box_Struct BBOX;
+ struct Bounding_Box_Struct {
+ };
+ inline void Make_BBox_from_min_max(BBOX& BBox, BBOX_VECT mins, BBOX_VECT maxs) {
+ }
+ typedef long long COUNTER;
+ inline double DBL_Counter(COUNTER x) {
+ }
+ struct Image_Struct {
+ union {
+ }
+ data;
+ };
+ struct Density_file_Data_Struct {
+ union {
+ }
+ Vals;
+ };
+ struct Pigment_Struct {
+ union {
+ struct {
+ }
+ Brick;
+ struct {
+ }
+ Fractal;
+ struct {
+ }
+ Function;
+ }
+ Vals;
+ };
+ typedef enum shelltype {
+ PRE_SCENE_SHL = 0, PRE_FRAME_SHL, POST_FRAME_SHL, POST_SCENE_SHL, USER_ABORT_SHL, FATAL_SHL, MAX_SHL }
+ SHELLRET;
+ }
+ typedef void * POVMSContext;
+ struct POVMSData {
+ };
+ int POVMS_OpenContext (POVMSContext *contextrefptr);
+ namespace pov_base {
+ enum {
+ kFalseErr = 1, kOutOfSyncErr = 2, kNotNowErr = kOutOfSyncErr, kQueueFullErr = 3 };
+ }
+ namespace pov_base {
+ class OTextStream {
+ };
+ }
+ enum {
+ kPOVMsgClass_RenderControl = 'Ctrl', kPOVMsgClass_RenderOutput = 'Outp', kPOVMsgClass_IniOptions = 'IniO', kPOVMsgClass_Miscellaneous = 'Misc' };
+ namespace pov_base {
+ class PlatformBase {
+ };
+ }
+ class POVMS_Container {
+ template<class T> void Read(T& stream) {
+ }
+ };
+ class POVMS_MessageReceiver {
+ private: class HandlerOO {
+ };
+ protected: template<class T> class MemberHandlerOO : public HandlerOO {
+ };
+ class FunctionHandlerOO : public HandlerOO {
+ };
+ template<class T> void InstallFront(unsigned int hclass, unsigned int hid, T *cptr, typename MemberHandlerOO<T>::MemberHandlerPtr hptr) {
+ }
+ };
+ namespace pov_base {
+ class TextStreamBuffer {
+ };
+ }
+ namespace pov_frontend {
+ using namespace pov_base;
+ class MessageOutput : public POVMS_MessageReceiver {
+ };
+ class DefaultPlatformBase : public PlatformBase {
+ };
+ }
+ using namespace pov;
+ namespace pov {
+ int pre_init_flag = 0;
+ }
+ POVMSContext POVMS_Render_Context = __null;
+ int main(int argc, char **argv) {
+ }
+ void povray_init() {
+ if (pre_init_flag == 0) {
+ int err;
+ err = POVMS_OpenContext(&POVMS_Render_Context);
+ }
+ }
diff --git a/gcc/testsuite/g++.dg/lto/pr45679-2_1.C b/gcc/testsuite/g++.dg/lto/pr45679-2_1.C
new file mode 100644
index 000000000..23ba08aec
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr45679-2_1.C
@@ -0,0 +1,100 @@
+extern "C" {
+ typedef struct __locale_struct {
+ }
+ *__locale_t;
+ union wait {
+ };
+ extern "C" {
+ }
+ typedef struct _IO_FILE FILE;
+ typedef struct {
+ union {
+ }
+ __value;
+ }
+ _G_fpos64_t;
+ struct _IO_marker {
+ }
+ _IO_cookie_io_functions_t;
+ extern struct _IO_FILE *stderr;
+ extern int fprintf (FILE *__restrict __stream, __const char *__restrict __format, ...);
+ }
+ enum {
+ kPOVMSObjectClassID = 'OCLA', kPOVMSMessageClassID = 'MCLA', kPOVMSMessageIdentID = 'MIDE', kPOVMSSourceAddressID = 'MSRC', kPOVMSDestinationAddressID = 'MDST', kPOVMSMessageTimeoutID = 'TOUT', kPOVMSMessageErrorID = 'MERR' };
+ typedef void * POVMSContext;
+ typedef struct POVMSData POVMSObject, *POVMSObjectPtr;
+ typedef struct POVMSData POVMSAttribute, *POVMSAttributePtr;
+ typedef struct POVMSData POVMSAttributeList, *POVMSAttributeListPtr;
+ struct POVMSData {
+ int size;
+ union {
+ void *ptr;
+ struct POVMSNode *root;
+ };
+ };
+ struct POVMSNode {
+ struct POVMSNode *next;
+ unsigned int key;
+ struct POVMSData data;
+ };
+ int POVMSObject_Set (POVMSObjectPtr object, POVMSAttributePtr attr, unsigned int key);
+ int POVMSAttr_Copy (POVMSAttributePtr sourceattr, POVMSAttributePtr destattr);
+ int POVMSUtil_GetType (POVMSObjectPtr object, unsigned int key, unsigned int *typevalue);
+ namespace pov_base {
+ enum {
+ kNoError = 0, kNoErr = kNoError, kParamErr = -1, kMemFullErr = -2, kOutOfMemoryErr = kMemFullErr, kInvalidDataSizeErr = -3, kCannotHandleDataErr = -4, kNullPointerErr = -5, kChecksumErr = -6, kParseErr = -7, kCannotOpenFileErr = -8, kInvalidDestAddrErr = -9, kCannotConnectErr = -10, kDisconnectedErr = -11, kHostDisconnectedErr = -12, kNetworkDataErr = -13, kNetworkConnectionErr = -14, kObjectAccessErr = -15, kVersionErr = -16, kFileDataErr = -17, kAuthorisationErr = -18, kDataTypeErr = -19, kTimeoutErr = -20, kInvalidContextErr = -21 };
+ }
+ using namespace pov_base;
+ struct POVMSContextData {
+ };
+ int POVMS_AssertFunction (int cond, const char *str, const char *filename, int line);
+ int POVMS_OpenContext(POVMSContext *contextrefptr) {
+ POVMSContextData *context = __null;
+ if(contextrefptr == __null) return kParamErr;
+ if(POVMS_AssertFunction(context != __null, "POVMS_Open_Context failed, out of memory", "povms.cpp", 283) == false) return kMemFullErr;
+ return kNoErr;
+ }
+ int POVMS_AssertFunction(int cond, const char *str, const char *filename, int line) {
+ if(cond == false) {
+ fprintf(stderr, "POVMS_ASSERT failed in %s line %d: %s\n", filename, (int)line, str);
+ }
+ }
+ int POVMSObject_Copy(POVMSObjectPtr sourceobject, POVMSObjectPtr destobject) {
+ POVMSNode *cur = __null;
+ POVMSAttribute attr;
+ unsigned int t1, t2;
+ int ret = kNoErr;
+ if(destobject == __null) return kParamErr;
+ if(POVMSUtil_GetType(sourceobject, kPOVMSObjectClassID, &t1) != kNoErr) return kObjectAccessErr;
+ if(POVMSUtil_GetType(sourceobject, kPOVMSObjectClassID, &t2) != kNoErr) return kObjectAccessErr;
+ if(t1 != t2) return kDataTypeErr;
+ for(cur = sourceobject->root;
+ cur != __null;
+ cur = cur->next) {
+ if(POVMS_AssertFunction(POVMSAttr_Copy(&(cur->data), &attr) == kNoErr, "POVMSObject_Merge failed, out of memory", "povms.cpp", 2084) == false) {
+ }
+ if(POVMS_AssertFunction(POVMSObject_Set(destobject, &attr, cur->key) == kNoErr, "POVMSObject_Merge failed, out of memory", "povms.cpp", 2090) == false) {
+ }
+ }
+ return ret;
+ }
+ int POVMSObject_Set(POVMSObjectPtr object, POVMSAttributePtr attr, unsigned int key) {
+ }
+ int POVMSAttrList_Copy(POVMSAttributeListPtr sourcelist, POVMSAttributeListPtr destlist) {
+ int cnt;
+ int err = kNoErr;
+ if(sourcelist == __null) return kParamErr;
+ if(destlist == __null) return kParamErr;
+ if(sourcelist == destlist) return kParamErr;
+ if(sourcelist->size < 0) return kParamErr;
+ if(sourcelist->size > 0) {
+ if(sourcelist->ptr != __null) {
+ if(POVMS_AssertFunction(destlist->ptr != __null, "POVMSAttrList_Copy failed, out of memory", "povms.cpp", 3020) == false) return -1;
+ }
+ for(cnt = 0;
+ cnt < sourcelist->size;
+ cnt++) {
+ }
+ }
+ return err;
+ }
diff --git a/gcc/testsuite/g++.dg/lto/pr45983_0.C b/gcc/testsuite/g++.dg/lto/pr45983_0.C
new file mode 100644
index 000000000..a2c9ba609
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr45983_0.C
@@ -0,0 +1,20 @@
+// PR c++/45983
+
+template <int N>
+class T1 {
+ int m[N];
+ typedef float scalar_type_t;
+ typedef scalar_type_t scalar_array_t[1];
+ const scalar_array_t &decay(void) const;
+};
+class T2 {
+public:
+ float vals[1];
+ float get_value(void) const { return vals[0]; }
+};
+T2 channel_params;
+float output_audio(void) {
+ return channel_params.get_value();
+}
+
+int main(){}
diff --git a/gcc/testsuite/g++.dg/lto/pr47333.C b/gcc/testsuite/g++.dg/lto/pr47333.C
new file mode 100644
index 000000000..60873ca07
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr47333.C
@@ -0,0 +1,944 @@
+namespace std
+{
+ typedef unsigned int size_t;
+ typedef int ptrdiff_t;
+
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+
+ template<typename _Alloc>
+ class allocator;
+
+ template<class _CharT>
+ struct char_traits;
+
+ template<typename _CharT, typename _Traits = char_traits<_CharT>,
+ typename _Alloc = allocator<_CharT> >
+ class basic_string;
+
+ template<> struct char_traits<char>;
+
+ typedef basic_string<char> string;
+
+ template<> struct char_traits<wchar_t>;
+
+ typedef basic_string<wchar_t> wstring;
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ void
+ __throw_bad_alloc(void) __attribute__((__noreturn__));
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Iterator, typename _Container>
+ class __normal_iterator;
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+
+ template<typename _Tp>
+ inline _Tp*
+ __addressof(_Tp& __r)
+ {
+ return reinterpret_cast<_Tp*>
+ (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
+ }
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<class _T1, class _T2>
+ struct pair
+ {
+ typedef _T1 first_type;
+ typedef _T2 second_type;
+
+ _T1 first;
+ _T2 second;
+
+ pair()
+ : first(), second() { }
+
+ pair(const _T1& __a, const _T2& __b)
+ : first(__a), second(__b) { }
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ struct input_iterator_tag { };
+
+ struct output_iterator_tag { };
+
+ struct forward_iterator_tag : public input_iterator_tag { };
+
+ struct bidirectional_iterator_tag : public forward_iterator_tag { };
+
+ struct random_access_iterator_tag : public bidirectional_iterator_tag { };
+ template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
+ typename _Pointer = _Tp*, typename _Reference = _Tp&>
+ struct iterator
+ {
+ typedef _Category iterator_category;
+ typedef _Tp value_type;
+ typedef _Distance difference_type;
+ typedef _Pointer pointer;
+ typedef _Reference reference;
+ };
+
+ template<typename _Iterator>
+ struct iterator_traits
+ {
+ typedef typename _Iterator::iterator_category iterator_category;
+ typedef typename _Iterator::value_type value_type;
+ typedef typename _Iterator::difference_type difference_type;
+ typedef typename _Iterator::pointer pointer;
+ typedef typename _Iterator::reference reference;
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Iterator>
+ class reverse_iterator
+ : public iterator<typename iterator_traits<_Iterator>::iterator_category,
+ typename iterator_traits<_Iterator>::value_type,
+ typename iterator_traits<_Iterator>::difference_type,
+ typename iterator_traits<_Iterator>::pointer,
+ typename iterator_traits<_Iterator>::reference>
+ {
+ protected:
+ _Iterator current;
+ typedef iterator_traits<_Iterator> __traits_type;
+ };
+}
+
+struct _IO_FILE;
+
+typedef struct _IO_FILE FILE;
+
+typedef struct _IO_FILE __FILE;
+
+typedef __builtin_va_list __gnuc_va_list;
+
+typedef unsigned int size_t;
+typedef unsigned int wint_t;
+
+typedef struct
+{
+ int __count;
+ union
+ {
+ unsigned int __wch;
+ char __wchb[4];
+ } __value;
+} __mbstate_t;
+
+
+typedef __mbstate_t mbstate_t;
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ using ::mbstate_t;
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ typedef long long streamoff;
+
+ typedef ptrdiff_t streamsize;
+ template<typename _StateT>
+ class fpos
+ {
+ private:
+ streamoff _M_off;
+ _StateT _M_state;
+
+ public:
+
+ fpos()
+ : _M_off(0), _M_state() { }
+ fpos(streamoff __off)
+ : _M_off(__off), _M_state() { }
+
+ operator streamoff() const { return _M_off; }
+
+ };
+
+ typedef fpos<mbstate_t> streampos;
+
+ typedef fpos<mbstate_t> wstreampos;
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _CharT>
+ struct _Char_types
+ {
+ typedef unsigned long int_type;
+ typedef std::streampos pos_type;
+ typedef std::streamoff off_type;
+ typedef std::mbstate_t state_type;
+ };
+ template<typename _CharT>
+ struct char_traits
+ {
+ typedef _CharT char_type;
+ typedef typename _Char_types<_CharT>::int_type int_type;
+ typedef typename _Char_types<_CharT>::pos_type pos_type;
+ typedef typename _Char_types<_CharT>::off_type off_type;
+ typedef typename _Char_types<_CharT>::state_type state_type;
+
+ static const char_type*
+ find(const char_type* __s, std::size_t __n, const char_type& __a);
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<class _CharT>
+ struct char_traits : public __gnu_cxx::char_traits<_CharT>
+ { };
+
+ template<>
+ struct char_traits<char>
+ {
+ typedef char char_type;
+ typedef int int_type;
+ typedef streampos pos_type;
+ typedef streamoff off_type;
+ typedef mbstate_t state_type;
+
+ static const char_type*
+ find(const char_type* __s, size_t __n, const char_type& __a)
+ { return static_cast<const char_type*>(__builtin_memchr(__s, __a, __n)); }
+ };
+}
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+
+ using std::size_t;
+ using std::ptrdiff_t;
+ template<typename _Tp>
+ class new_allocator
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ new_allocator() throw() { }
+
+ new_allocator(const new_allocator&) throw() { }
+
+ template<typename _Tp1>
+ new_allocator(const new_allocator<_Tp1>&) throw() { }
+
+ ~new_allocator() throw() { }
+
+ pointer
+ allocate(size_type __n, const void* = 0)
+ {
+ if (__n > this->max_size())
+ std::__throw_bad_alloc();
+
+ return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
+ }
+ void
+ deallocate(pointer __p, size_type)
+ { ::operator delete(__p); }
+
+ void
+ destroy(pointer __p) { __p->~_Tp(); }
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp>
+ class allocator;
+
+ template<typename _Tp>
+ class allocator: public __gnu_cxx::new_allocator<_Tp>
+ {
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
+
+ template<typename _Tp1>
+ struct rebind
+ { typedef allocator<_Tp1> other; };
+
+ allocator() throw() { }
+
+ allocator(const allocator& __a) throw()
+ : __gnu_cxx::new_allocator<_Tp>(__a) { }
+
+ template<typename _Tp1>
+ allocator(const allocator<_Tp1>&) throw() { }
+
+ ~allocator() throw() { }
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Arg, typename _Result>
+ struct unary_function
+ {
+ typedef _Arg argument_type;
+ typedef _Result result_type;
+ };
+
+ template<typename _Arg1, typename _Arg2, typename _Result>
+ struct binary_function
+ {
+ typedef _Arg1 first_argument_type;
+ typedef _Arg2 second_argument_type;
+ typedef _Result result_type;
+ };
+
+ template<typename _Tp>
+ struct less : public binary_function<_Tp, _Tp, bool>
+ {
+ bool
+ operator()(const _Tp& __x, const _Tp& __y) const
+ { return __x < __y; }
+ };
+
+ template<typename _Pair>
+ struct _Select1st : public unary_function<_Pair,
+ typename _Pair::first_type>
+ {
+ typename _Pair::first_type&
+ operator()(_Pair& __x) const
+ { return __x.first; }
+
+ const typename _Pair::first_type&
+ operator()(const _Pair& __x) const
+ { return __x.first; }
+ };
+}
+
+extern "C" {
+
+typedef int __sig_atomic_t;
+
+typedef struct
+ {
+ unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
+ } __sigset_t;
+typedef __sigset_t sigset_t;
+}
+typedef unsigned long int pthread_t;
+
+typedef struct __pthread_internal_slist
+{
+ struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+
+typedef union
+{
+ struct __pthread_mutex_s
+ {
+ int __lock;
+ unsigned int __count;
+ int __owner;
+ int __kind;
+
+ unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ __pthread_slist_t __list;
+ };
+
+ } __data;
+ char __size[24];
+ long int __align;
+} pthread_mutex_t;
+
+typedef unsigned int pthread_key_t;
+
+typedef int pthread_once_t;
+
+extern int pthread_once (pthread_once_t *__once_control,
+ void (*__init_routine) (void)) __attribute__ ((__nonnull__ (1, 2)));
+
+extern int pthread_mutex_lock (pthread_mutex_t *__mutex)
+ throw () __attribute__ ((__nonnull__ (1)));
+
+extern int pthread_mutex_unlock (pthread_mutex_t *__mutex)
+ throw () __attribute__ ((__nonnull__ (1)));
+
+typedef pthread_t __gthread_t;
+typedef pthread_key_t __gthread_key_t;
+typedef pthread_once_t __gthread_once_t;
+typedef pthread_mutex_t __gthread_mutex_t;
+
+static __typeof(pthread_once) __gthrw_pthread_once __attribute__ ((__weakref__("pthread_once")));
+
+static __typeof(pthread_mutex_lock) __gthrw_pthread_mutex_lock __attribute__ ((__weakref__("pthread_mutex_lock")));
+
+static __typeof(pthread_mutex_unlock) __gthrw_pthread_mutex_unlock __attribute__ ((__weakref__("pthread_mutex_unlock")));
+
+static volatile int __gthread_active = -1;
+
+static void
+__gthread_trigger (void)
+{
+ __gthread_active = 1;
+}
+
+static inline int
+__gthread_active_p (void)
+{
+ static pthread_mutex_t __gthread_active_mutex = { { 0, 0, 0, 0, 0, { 0 } } };
+ static pthread_once_t __gthread_active_once = 0;
+
+ int __gthread_active_latest_value = __gthread_active;
+
+ if (__builtin_expect (__gthread_active_latest_value < 0, 0))
+ {
+ if (__gthrw_pthread_once)
+ {
+ __gthrw_pthread_mutex_lock (&__gthread_active_mutex);
+ __gthrw_pthread_once (&__gthread_active_once, __gthread_trigger);
+ __gthrw_pthread_mutex_unlock (&__gthread_active_mutex);
+ }
+
+ if (__gthread_active < 0)
+ __gthread_active = 0;
+ __gthread_active_latest_value = __gthread_active;
+ }
+
+ return __gthread_active_latest_value != 0;
+}
+
+typedef int _Atomic_word;
+
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+
+ static inline _Atomic_word
+ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
+ { return __sync_fetch_and_add(__mem, __val); }
+
+ static inline void
+ __atomic_add(volatile _Atomic_word* __mem, int __val)
+ { __sync_fetch_and_add(__mem, __val); }
+ static inline _Atomic_word
+ __exchange_and_add_single(_Atomic_word* __mem, int __val)
+ {
+ _Atomic_word __result = *__mem;
+ *__mem += __val;
+ return __result;
+ }
+
+ static inline void
+ __atomic_add_single(_Atomic_word* __mem, int __val)
+ { *__mem += __val; }
+
+ static inline _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add_dispatch(_Atomic_word* __mem, int __val)
+ {
+ if (__gthread_active_p())
+ return __exchange_and_add(__mem, __val);
+ else
+ return __exchange_and_add_single(__mem, __val);
+ }
+
+ static inline void
+ __attribute__ ((__unused__))
+ __atomic_add_dispatch(_Atomic_word* __mem, int __val)
+ {
+ if (__gthread_active_p())
+ __atomic_add(__mem, __val);
+ else
+ __atomic_add_single(__mem, __val);
+ }
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_string
+ {
+ typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
+
+ public:
+ typedef _Traits traits_type;
+ typedef typename _Traits::char_type value_type;
+ typedef _Alloc allocator_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+ typedef typename _CharT_alloc_type::difference_type difference_type;
+ typedef typename _CharT_alloc_type::reference reference;
+ typedef typename _CharT_alloc_type::const_reference const_reference;
+ typedef typename _CharT_alloc_type::pointer pointer;
+ typedef typename _CharT_alloc_type::const_pointer const_pointer;
+ typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
+ typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
+ const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+
+ private:
+ struct _Rep_base
+ {
+ size_type _M_length;
+ size_type _M_capacity;
+ _Atomic_word _M_refcount;
+ };
+
+ struct _Rep : _Rep_base
+ {
+
+ typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
+ static const size_type _S_max_size;
+ static const _CharT _S_terminal;
+
+ static size_type _S_empty_rep_storage[];
+
+ static _Rep&
+ _S_empty_rep()
+ {
+ void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);
+ return *reinterpret_cast<_Rep*>(__p);
+ }
+
+ _CharT*
+ _M_refdata() throw()
+ { return reinterpret_cast<_CharT*>(this + 1); }
+
+ void
+ _M_dispose(const _Alloc& __a)
+ {
+ if (__builtin_expect(this != &_S_empty_rep(), false))
+ {
+ ;
+ if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
+ -1) <= 0)
+ {
+ ;
+ _M_destroy(__a);
+ }
+ }
+ }
+
+ void
+ _M_destroy(const _Alloc&) throw();
+
+ _CharT*
+ _M_refcopy() throw()
+ {
+ if (__builtin_expect(this != &_S_empty_rep(), false))
+ __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
+ return _M_refdata();
+ }
+ };
+
+ struct _Alloc_hider : _Alloc
+ {
+ _Alloc_hider(_CharT* __dat, const _Alloc& __a)
+ : _Alloc(__a), _M_p(__dat) { }
+
+ _CharT* _M_p;
+ };
+
+ private:
+
+ mutable _Alloc_hider _M_dataplus;
+
+ _CharT*
+ _M_data() const
+ { return _M_dataplus._M_p; }
+
+ _Rep*
+ _M_rep() const
+ { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
+
+ void
+ _M_leak_hard();
+
+ public:
+
+ ~basic_string()
+ { _M_rep()->_M_dispose(this->get_allocator()); }
+
+ public:
+
+ allocator_type
+ get_allocator() const
+ { return _M_dataplus; }
+ };
+}
+
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ enum _Rb_tree_color { _S_red = false, _S_black = true };
+
+ struct _Rb_tree_node_base
+ {
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef const _Rb_tree_node_base* _Const_Base_ptr;
+
+ _Rb_tree_color _M_color;
+ _Base_ptr _M_parent;
+ _Base_ptr _M_left;
+ _Base_ptr _M_right;
+
+ static _Base_ptr
+ _S_minimum(_Base_ptr __x)
+ {
+ while (__x->_M_left != 0) __x = __x->_M_left;
+ return __x;
+ }
+
+ static _Const_Base_ptr
+ _S_minimum(_Const_Base_ptr __x)
+ {
+ while (__x->_M_left != 0) __x = __x->_M_left;
+ return __x;
+ }
+
+ static _Base_ptr
+ _S_maximum(_Base_ptr __x)
+ {
+ while (__x->_M_right != 0) __x = __x->_M_right;
+ return __x;
+ }
+
+ static _Const_Base_ptr
+ _S_maximum(_Const_Base_ptr __x)
+ {
+ while (__x->_M_right != 0) __x = __x->_M_right;
+ return __x;
+ }
+ };
+
+ template<typename _Val>
+ struct _Rb_tree_node : public _Rb_tree_node_base
+ {
+ typedef _Rb_tree_node<_Val>* _Link_type;
+ _Val _M_value_field;
+ };
+
+ __attribute__ ((__pure__)) _Rb_tree_node_base*
+ _Rb_tree_increment(_Rb_tree_node_base* __x) throw ();
+
+ __attribute__ ((__pure__)) const _Rb_tree_node_base*
+ _Rb_tree_increment(const _Rb_tree_node_base* __x) throw ();
+
+ __attribute__ ((__pure__)) _Rb_tree_node_base*
+ _Rb_tree_decrement(_Rb_tree_node_base* __x) throw ();
+
+ __attribute__ ((__pure__)) const _Rb_tree_node_base*
+ _Rb_tree_decrement(const _Rb_tree_node_base* __x) throw ();
+
+ template<typename _Tp>
+ struct _Rb_tree_iterator
+ {
+ typedef _Tp value_type;
+ typedef _Tp& reference;
+ typedef _Tp* pointer;
+
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+
+ typedef _Rb_tree_iterator<_Tp> _Self;
+ typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
+ typedef _Rb_tree_node<_Tp>* _Link_type;
+
+ _Rb_tree_iterator()
+ : _M_node() { }
+
+ explicit
+ _Rb_tree_iterator(_Link_type __x)
+ : _M_node(__x) { }
+
+ bool
+ operator==(const _Self& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Self& __x) const
+ { return _M_node != __x._M_node; }
+
+ _Base_ptr _M_node;
+ };
+
+ template<typename _Tp>
+ struct _Rb_tree_const_iterator
+ {
+ typedef _Tp value_type;
+ typedef const _Tp& reference;
+ typedef const _Tp* pointer;
+
+ typedef _Rb_tree_iterator<_Tp> iterator;
+
+ typedef bidirectional_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+
+ typedef _Rb_tree_const_iterator<_Tp> _Self;
+ typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
+ typedef const _Rb_tree_node<_Tp>* _Link_type;
+
+ _Rb_tree_const_iterator()
+ : _M_node() { }
+
+ explicit
+ _Rb_tree_const_iterator(_Link_type __x)
+ : _M_node(__x) { }
+
+ _Rb_tree_const_iterator(const iterator& __it)
+ : _M_node(__it._M_node) { }
+
+ pointer
+ operator->() const
+ { return std::__addressof(static_cast<_Link_type>
+ (_M_node)->_M_value_field); }
+
+ bool
+ operator==(const _Self& __x) const
+ { return _M_node == __x._M_node; }
+
+ bool
+ operator!=(const _Self& __x) const
+ { return _M_node != __x._M_node; }
+
+ _Base_ptr _M_node;
+ };
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc = allocator<_Val> >
+ class _Rb_tree
+ {
+ typedef typename _Alloc::template rebind<_Rb_tree_node<_Val> >::other
+ _Node_allocator;
+
+ protected:
+ typedef _Rb_tree_node_base* _Base_ptr;
+ typedef const _Rb_tree_node_base* _Const_Base_ptr;
+
+ public:
+ typedef _Key key_type;
+ typedef _Val value_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+ typedef _Rb_tree_node<_Val>* _Link_type;
+ typedef const _Rb_tree_node<_Val>* _Const_Link_type;
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
+
+ const _Node_allocator&
+ _M_get_Node_allocator() const
+ { return *static_cast<const _Node_allocator*>(&this->_M_impl); }
+
+ allocator_type
+ get_allocator() const
+ { return allocator_type(_M_get_Node_allocator()); }
+
+ protected:
+ void
+ _M_put_node(_Link_type __p)
+ { _M_impl._Node_allocator::deallocate(__p, 1); }
+
+ void
+ _M_destroy_node(_Link_type __p)
+ {
+ get_allocator().destroy(std::__addressof(__p->_M_value_field));
+ _M_put_node(__p);
+ }
+
+ protected:
+ template<typename _Key_compare,
+ bool _Is_pod_comparator = __is_pod(_Key_compare)>
+ struct _Rb_tree_impl : public _Node_allocator
+ {
+ _Key_compare _M_key_compare;
+ _Rb_tree_node_base _M_header;
+ size_type _M_node_count;
+
+ private:
+ void
+ _M_initialize()
+ {
+ this->_M_header._M_color = _S_red;
+ this->_M_header._M_parent = 0;
+ this->_M_header._M_left = &this->_M_header;
+ this->_M_header._M_right = &this->_M_header;
+ }
+ };
+
+ _Rb_tree_impl<_Compare> _M_impl;
+
+ protected:
+
+ _Link_type
+ _M_begin()
+ { return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); }
+
+ _Link_type
+ _M_end()
+ { return static_cast<_Link_type>(&this->_M_impl._M_header); }
+
+ static _Link_type
+ _S_left(_Base_ptr __x)
+ { return static_cast<_Link_type>(__x->_M_left); }
+
+ static _Link_type
+ _S_right(_Base_ptr __x)
+ { return static_cast<_Link_type>(__x->_M_right); }
+
+ static const_reference
+ _S_value(_Const_Base_ptr __x)
+ { return static_cast<_Const_Link_type>(__x)->_M_value_field; }
+
+ static const _Key&
+ _S_key(_Const_Base_ptr __x)
+ { return _KeyOfValue()(_S_value(__x)); }
+
+ public:
+ typedef _Rb_tree_iterator<value_type> iterator;
+ typedef _Rb_tree_const_iterator<value_type> const_iterator;
+
+ private:
+
+ void
+ _M_erase(_Link_type __x);
+
+ iterator
+ _M_lower_bound(_Link_type __x, _Link_type __y,
+ const _Key& __k);
+
+ const_iterator
+ _M_lower_bound(_Const_Link_type __x, _Const_Link_type __y,
+ const _Key& __k) const;
+
+ public:
+
+ ~_Rb_tree()
+ { _M_erase(_M_begin()); }
+
+ iterator
+ end()
+ { return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); }
+
+ const_iterator
+ end() const
+ {
+ return const_iterator(static_cast<_Const_Link_type>
+ (&this->_M_impl._M_header));
+ }
+
+ public:
+ iterator
+ find(const key_type& __k);
+ };
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ void
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_erase(_Link_type __x)
+ {
+
+ while (__x != 0)
+ {
+ _M_erase(_S_right(__x));
+ _Link_type __y = _S_left(__x);
+ _M_destroy_node(__x);
+ __x = __y;
+ }
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ _M_lower_bound(_Link_type __x, _Link_type __y,
+ const _Key& __k)
+ {
+ while (__x != 0)
+ if (!_M_impl._M_key_compare(_S_key(__x), __k))
+ __y = __x, __x = _S_left(__x);
+ else
+ __x = _S_right(__x);
+ return iterator(__y);
+ }
+
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue,
+ _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ find(const _Key& __k)
+ {
+ iterator __j = _M_lower_bound(_M_begin(), _M_end(), __k);
+ return (__j == end()
+ || _M_impl._M_key_compare(__k,
+ _S_key(__j._M_node))) ? end() : __j;
+ }
+
+}
+
+namespace std {
+ template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+ typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ class map
+ {
+ public:
+ typedef _Key key_type;
+ typedef _Tp mapped_type;
+ typedef std::pair<const _Key, _Tp> value_type;
+ typedef _Compare key_compare;
+ typedef _Alloc allocator_type;
+
+ private:
+
+ typedef typename _Alloc::template rebind<value_type>::other
+ _Pair_alloc_type;
+
+ typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
+ key_compare, _Pair_alloc_type> _Rep_type;
+
+ _Rep_type _M_t;
+
+ public:
+
+ typedef typename _Rep_type::iterator iterator;
+ typedef typename _Rep_type::const_iterator const_iterator;
+
+ map()
+ : _M_t() { }
+
+ const_iterator
+ end() const
+ { return _M_t.end(); }
+
+ key_compare
+ key_comp() const
+ { return _M_t.key_comp(); }
+
+ iterator
+ find(const key_type& __x)
+ { return _M_t.find(__x); }
+ };
+}
+
+int main ()
+{
+ typedef std::map<int, std::string> Map;
+ static Map m;
+
+ Map::const_iterator it = m.find(0);
+ if (it != m.end())
+ std::string s = it->second;
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/pr48207-2_0.C b/gcc/testsuite/g++.dg/lto/pr48207-2_0.C
new file mode 100644
index 000000000..6801b85a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr48207-2_0.C
@@ -0,0 +1,10 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+namespace {
+ typedef struct {
+ int x;
+ } Foo;
+}
+
+int main () {}
diff --git a/gcc/testsuite/g++.dg/lto/pr48207-3_0.C b/gcc/testsuite/g++.dg/lto/pr48207-3_0.C
new file mode 100644
index 000000000..ef02dda84
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr48207-3_0.C
@@ -0,0 +1,12 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+void bar(void) {}
+
+void foo(void)
+{
+ typedef enum { ABC } DEF;
+ bar();
+}
+
+int main () {}
diff --git a/gcc/testsuite/g++.dg/lto/pr48207_0.C b/gcc/testsuite/g++.dg/lto/pr48207_0.C
new file mode 100644
index 000000000..e66cb491b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr48207_0.C
@@ -0,0 +1,13 @@
+// { dg-lto-do link }
+// { dg-lto-options { { -flto -g } } }
+
+void bar(int) {}
+
+void foo(void)
+{
+ typedef enum { ABC } DEF;
+ DEF a;
+ bar((int)a);
+}
+
+int main() {}