From 297550593e630370d8e269b47083b891bb9a563a Mon Sep 17 00:00:00 2001 From: hubicka Date: Sat, 27 Mar 2010 11:56:30 +0000 Subject: [PATCH] PR middle-end/43391 * varasm.c (make_decl_rtl): Deal with COMMON flag to make notice_global_symbol work. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157773 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/varasm.c | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7fb9e3d6bc7..d4f4488e512 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-03-27 Jan Hubicka + + PR middle-end/43391 + * varasm.c (make_decl_rtl): Deal with COMMON flag to make + notice_global_symbol work. + 2010-03-27 Jakub Jelinek * dwarf2out.c (dwarf2_debug_hooks): Use dwarf2out_function_decl diff --git a/gcc/varasm.c b/gcc/varasm.c index ba4e6121834..af9adffd73d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1435,16 +1435,19 @@ make_decl_rtl (tree decl) /* Specifying a section attribute on a variable forces it into a non-.bss section, and thus it cannot be common. */ - gcc_assert (!(TREE_CODE (decl) == VAR_DECL - && DECL_SECTION_NAME (decl) != NULL_TREE - && DECL_INITIAL (decl) == NULL_TREE - && DECL_COMMON (decl)) - || !DECL_COMMON (decl)); + /* FIXME: In general this code should not be necessary because + visibility pass is doing the same work. But notice_global_symbol + is called early and it needs to make DECL_RTL to get the name. + we take care of recomputing the DECL_RTL after visibility is changed. */ + if (TREE_CODE (decl) == VAR_DECL + && DECL_SECTION_NAME (decl) != NULL_TREE + && DECL_INITIAL (decl) == NULL_TREE + && DECL_COMMON (decl)) + DECL_COMMON (decl) = 0; /* Variables can't be both common and weak. */ - gcc_assert (TREE_CODE (decl) != VAR_DECL - || !DECL_WEAK (decl) - || !DECL_COMMON (decl)); + if (TREE_CODE (decl) == VAR_DECL && DECL_WEAK (decl)) + DECL_COMMON (decl) = 0; if (use_object_blocks_p () && use_blocks_for_decl_p (decl)) x = create_block_symbol (name, get_block_for_decl (decl), -1); -- 2.11.0