public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/51573] [4.7 Regression] ICE (segfault) in lto_varpool_encoder_encode_initializer_p Date: Fri, 16 Dec 2011 10:49:00 -0000 [thread overview] Message-ID: <bug-51573-4-4hBNP2W9zt@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-51573-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51573 Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dnovillo at gcc dot | |gnu.org, jason at gcc dot | |gnu.org Blocks| |48508, 48437 --- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-16 10:21:16 UTC --- Because of the way C++ treats things (look at PR48508) it is impossible to move fixing PRs 48508 and 48437 to the point where we handle decl merging. Thus, while Index: gcc/lto-symtab.c =================================================================== --- gcc/lto-symtab.c (revision 182398) +++ gcc/lto-symtab.c (working copy) @@ -785,6 +785,12 @@ lto_symtab_prevailing_decl (tree decl) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_ABSTRACT (decl)) return decl; + /* Extern decls with function context should not be merged, they + appear in BLOCK_VARS. */ + if (DECL_EXTERNAL (decl) + && decl_function_context (decl)) + return decl; + /* Ensure DECL_ASSEMBLER_NAME will not set assembler name. */ gcc_assert (DECL_ASSEMBLER_NAME_SET_P (decl)); Index: gcc/lto/lto.c =================================================================== --- gcc/lto/lto.c (revision 182398) +++ gcc/lto/lto.c (working copy) @@ -867,9 +867,13 @@ uniquify_nodes (struct data_in *data_in, if (t == NULL_TREE) continue; - if (TREE_CODE (t) == VAR_DECL) + if (TREE_CODE (t) == VAR_DECL + && (!DECL_EXTERNAL (t) + || !decl_function_context (t))) lto_register_var_decl_in_symtab (data_in, t); - else if (TREE_CODE (t) == FUNCTION_DECL && !DECL_BUILT_IN (t)) + else if (TREE_CODE (t) == FUNCTION_DECL && !DECL_BUILT_IN (t) + && (!DECL_EXTERNAL (t) + || !decl_function_context (t))) lto_register_function_decl_in_symtab (data_in, t); else if (TYPE_P (t) && !TYPE_CANONICAL (t)) TYPE_CANONICAL (t) = gimple_register_canonical_type (t); works great for C it does not work for C++ at all because in static void bar (void) { extern void foo (int); foo (0); } the function-local extern declaration of 'foo' has a toplevel DECL_CONTEXT. Thus the only way I see to fix this bug is to introduce either a new streaming hook or add an argument to the stream_write_tree that indicates whether the actual tree should be streamed by reference, not affecting its siblings.
next prev parent reply other threads:[~2011-12-16 10:24 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-15 18:09 [Bug lto/51573] New: " markus at trippelsdorf dot de 2011-12-15 18:57 ` [Bug lto/51573] " markus at trippelsdorf dot de 2011-12-16 8:36 ` rguenth at gcc dot gnu.org 2011-12-16 9:41 ` rguenth at gcc dot gnu.org 2011-12-16 10:24 ` rguenth at gcc dot gnu.org 2011-12-16 10:49 ` rguenth at gcc dot gnu.org [this message] 2011-12-16 12:17 ` rguenth at gcc dot gnu.org 2011-12-16 13:12 ` rguenth at gcc dot gnu.org 2011-12-16 13:23 ` rguenth at gcc dot gnu.org 2011-12-16 13:36 ` rguenth at gcc dot gnu.org 2011-12-16 15:45 ` rguenth at gcc dot gnu.org 2011-12-19 16:01 ` rguenth at gcc dot gnu.org 2011-12-19 16:01 ` rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-51573-4-4hBNP2W9zt@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).