Commit 5074d72c by Richard Guenther Committed by Richard Biener

re PR lto/45956 (Promoted statics conflict)

2010-10-09  Richard Guenther  <rguenther@suse.de>

	PR lto/45956
	* lto-streamer-in.c (lto_register_var_decl_in_symtab):
	Properly check if a decl is an automatic var.

	* gcc.dg/lto/20101009-2_0.c: New testcase.
	* gcc.dg/lto/20101009-2_1.c: Likewise.
	* gcc.dg/lto/20101009-2_2.c: Likewise.

From-SVN: r165235
parent 865e8e8e
2010-10-09 Richard Guenther <rguenther@suse.de> 2010-10-09 Richard Guenther <rguenther@suse.de>
PR lto/45956
* lto-streamer-in.c (lto_register_var_decl_in_symtab):
Properly check if a decl is an automatic var.
2010-10-09 Richard Guenther <rguenther@suse.de>
PR lto/45947 PR lto/45947
* tree.c (free_lang_data_in_cgraph): Properly walk the varpool. * tree.c (free_lang_data_in_cgraph): Properly walk the varpool.
...@@ -2367,13 +2367,13 @@ lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in, ...@@ -2367,13 +2367,13 @@ lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in,
static void static void
lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl) lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl)
{ {
/* Register symbols with file or global scope to mark what input tree context;
file has their definition. */
if (decl_function_context (decl) == NULL_TREE)
{
/* Variable has file scope, not local. Need to ensure static variables /* Variable has file scope, not local. Need to ensure static variables
between different files don't clash unexpectedly. */ between different files don't clash unexpectedly. */
if (!TREE_PUBLIC (decl)) if (!TREE_PUBLIC (decl)
&& !((context = decl_function_context (decl))
&& auto_var_in_fn_p (decl, context)))
{ {
/* ??? We normally pre-mangle names before we serialize them /* ??? We normally pre-mangle names before we serialize them
out. Here, in lto1, we do not know the language, and out. Here, in lto1, we do not know the language, and
...@@ -2388,7 +2388,6 @@ lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl) ...@@ -2388,7 +2388,6 @@ lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl)
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label));
rest_of_decl_compilation (decl, 1, 0); rest_of_decl_compilation (decl, 1, 0);
} }
}
/* If this variable has already been declared, queue the /* If this variable has already been declared, queue the
declaration for merging. */ declaration for merging. */
......
2010-10-09 Richard Guenther <rguenther@suse.de> 2010-10-09 Richard Guenther <rguenther@suse.de>
PR lto/45956
* gcc.dg/lto/20101009-2_0.c: New testcase.
* gcc.dg/lto/20101009-2_1.c: Likewise.
* gcc.dg/lto/20101009-2_2.c: Likewise.
2010-10-09 Richard Guenther <rguenther@suse.de>
PR lto/45947 PR lto/45947
* g++.dg/lto/20101009-1_0.C: New testcase. * g++.dg/lto/20101009-1_0.C: New testcase.
......
/* { dg-lto-do link } */
int main() { return 0; }
int foo (void)
{
static int i;
return ++i;
}
int bar (void)
{
static int i;
return ++i;
}
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