Commit 1d5053d6 by Jason Merrill Committed by Jason Merrill

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
parent 2c71ac78
......@@ -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>
......
......@@ -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
......
......@@ -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);
}
}
}
......
......@@ -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
......
......@@ -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>
......
typedef float mm128 __attribute ((vector_size (16)));
template <class T>
struct A
{
static T t;
};
void f (mm128 *);
// 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 = { };
// { dg-options "-fabi-version=0" }
#include "20100302.h"
int main()
{
f(& A<mm128>::t);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment