diff options
author | Richard Guenther <rguenther@suse.de> | 2010-10-09 18:28:16 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-10-09 18:28:16 +0000 |
commit | 5074d72c59a2d98e1c5162b1144d060d319bd519 (patch) | |
tree | b6d32175f905f948e2fb23d15798400a1502b13a /gcc/lto-streamer-in.c | |
parent | 865e8e8e51cfb9ab312c2f6618ff9d0d713e1b39 (diff) | |
download | gcc-5074d72c59a2d98e1c5162b1144d060d319bd519.tar.gz |
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
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r-- | gcc/lto-streamer-in.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index fb27e63b753..72ac6eca2f3 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -2367,27 +2367,26 @@ lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in, static void lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl) { - /* Register symbols with file or global scope to mark what input - file has their definition. */ - if (decl_function_context (decl) == NULL_TREE) - { - /* Variable has file scope, not local. Need to ensure static variables - between different files don't clash unexpectedly. */ - if (!TREE_PUBLIC (decl)) - { - /* ??? We normally pre-mangle names before we serialize them - out. Here, in lto1, we do not know the language, and - thus cannot do the mangling again. Instead, we just - append a suffix to the mangled name. The resulting name, - however, is not a properly-formed mangled name, and will - confuse any attempt to unmangle it. */ - const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - char *label; - - ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); - rest_of_decl_compilation (decl, 1, 0); - } + tree context; + + /* Variable has file scope, not local. Need to ensure static variables + between different files don't clash unexpectedly. */ + 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 + out. Here, in lto1, we do not know the language, and + thus cannot do the mangling again. Instead, we just + append a suffix to the mangled name. The resulting name, + however, is not a properly-formed mangled name, and will + confuse any attempt to unmangle it. */ + const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); + char *label; + + ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl)); + SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label)); + rest_of_decl_compilation (decl, 1, 0); } /* If this variable has already been declared, queue the |