aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-03-03 14:02:08 -0500
committerJason Merrill <jason@gcc.gnu.org>2010-03-03 14:02:08 -0500
commit1d5053d6b407b6fc493151a3581df7c628ffa72b (patch)
tree194d8b86327b39798460337e66b7e50860713988 /gcc
parent2c71ac786646a4ed4d221a574b2797c66549e9d6 (diff)
downloadgcc-1d5053d6b407b6fc493151a3581df7c628ffa72b.zip
gcc-1d5053d6b407b6fc493151a3581df7c628ffa72b.tar.gz
gcc-1d5053d6b407b6fc493151a3581df7c628ffa72b.tar.bz2
re PR c++/12909 (ambiguity in mangling vector types)
PR c++/12909 * lto-streamer.h (LTO_tags): Add LTO_var_decl_alias. * lto-streamer-in.c (lto_input_tree): Read it. * lto-streamer-out.c (output_unreferenced_globals): Write it. From-SVN: r157204
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/lto-streamer-in.c11
-rw-r--r--gcc/lto-streamer-out.c13
-rw-r--r--gcc/lto-streamer.h3
-rw-r--r--gcc/testsuite/ChangeLog3
-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
8 files changed, 59 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1ae9f67..1b749f4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -5,6 +5,9 @@
* varpool.c (varpool_extra_name_alias): New.
(varpool_assemble_decl): Emit extra name aliases.
(varpool_mark_needed_node): Look past an extra name alias.
+ * lto-streamer.h (LTO_tags): Add LTO_var_decl_alias.
+ * lto-streamer-in.c (lto_input_tree): Read it.
+ * lto-streamer-out.c (output_unreferenced_globals): Write it.
2010-03-03 Eric Botcazou <ebotcazou@adacore.com>
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 0955914..b098be2 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -2696,6 +2696,17 @@ lto_input_tree (struct lto_input_block *ib, struct data_in *data_in)
the code and class. */
result = lto_get_builtin_tree (ib, data_in);
}
+ else if (tag == LTO_var_decl_alias)
+ {
+ /* An extra_name alias for a variable. */
+ unsigned HOST_WIDE_INT ix;
+ tree target;
+ ix = lto_input_uleb128 (ib);
+ result = lto_file_decl_data_get_var_decl (data_in->file_data, ix);
+ ix = lto_input_uleb128 (ib);
+ target = lto_file_decl_data_get_var_decl (data_in->file_data, ix);
+ varpool_extra_name_alias (result, target);
+ }
else if (tag == lto_tree_code_to_tag (INTEGER_CST))
{
/* For integer constants we only need the type and its hi/low
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index b5fc3e2..f375282 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1978,6 +1978,8 @@ output_unreferenced_globals (cgraph_node_set set)
if (TREE_CODE (var) == VAR_DECL)
{
+ struct varpool_node *alias;
+
/* Output the object in order to output references used in the
initialization. */
lto_output_tree (ob, var, true);
@@ -1985,6 +1987,17 @@ output_unreferenced_globals (cgraph_node_set set)
/* If it is public we also need a reference to the object itself. */
if (TREE_PUBLIC (var))
lto_output_tree_ref (ob, var);
+
+ /* Also output any extra_name aliases for this variable. */
+ for (alias = vnode->extra_name; alias; alias = alias->next)
+ {
+ lto_output_tree (ob, alias->decl, true);
+ output_record_start (ob, LTO_var_decl_alias);
+ lto_output_var_decl_index (ob->decl_state, ob->main_stream,
+ alias->decl);
+ lto_output_var_decl_index (ob->decl_state, ob->main_stream,
+ var);
+ }
}
}
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 703d6fa..e67b669 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -217,6 +217,9 @@ enum LTO_tags
/* Special for global streamer. Reference to previously-streamed node. */
LTO_tree_pickle_reference,
+ /* A decl which exists only to provide an extra symbol for another var. */
+ LTO_var_decl_alias,
+
/* References to indexable tree nodes. These objects are stored in
tables that are written separately from the function bodies that
reference them. This way they can be instantiated even when the
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 77aaf9c..637680f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -3,6 +3,9 @@
PR c++/12909
* g++.dg/abi/mangle40.C: New.
* g++.dg/abi/mangle41.C: New.
+ * g++.dg/lto/20100302_0.C: New.
+ * g++.dg/lto/20100302_1.C: New.
+ * g++.dg/lto/20100302.h: New.
2010-03-03 Paul Thomas <pault@gcc.gnu.org>
diff --git a/gcc/testsuite/g++.dg/lto/20100302.h b/gcc/testsuite/g++.dg/lto/20100302.h
new file mode 100644
index 0000000..7260be1
--- /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 0000000..13d4373
--- /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-*-* } } { "*" } { "" } }
+// { 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 0000000..48548b6
--- /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);
+}