diff options
author | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-03-10 19:33:37 +0000 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-03-10 19:33:37 +0000 |
commit | e9fecf0ecc861d657aacd9ba5142a393992d67c2 (patch) | |
tree | 34602e6c1f37225bd018fc35fc4b5af53b796857 /gcc/ipa.c | |
parent | 7d8c1528861237b7fab2e8057e7cec9aeea83f8b (diff) | |
download | gcc-e9fecf0ecc861d657aacd9ba5142a393992d67c2.zip gcc-e9fecf0ecc861d657aacd9ba5142a393992d67c2.tar.gz gcc-e9fecf0ecc861d657aacd9ba5142a393992d67c2.tar.bz2 |
re PR c/43288 (ICE in function_and_variable_visibility, at ipa.c:415)
PR c/43288
* ipa.c (function_and_variable_visibility) Normalize COMMON bits.
* varasm.c (get_variable_section): Don't do that here...
(make_decl_rtl): ... and here.
(do_assemble_alias): Produce decl RTL.
(assemble_alias): Likewise.
* gcc.dg/compile/pr43288.c: New test.
From-SVN: r157366
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r-- | gcc/ipa.c | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -407,12 +407,38 @@ function_and_variable_visibility (bool whole_program) && !DECL_EXTERNAL (node->decl) && !node->local.externally_visible); } + for (vnode = varpool_nodes; vnode; vnode = vnode->next) + { + /* weak flag makes no sense on local variables. */ + gcc_assert (!DECL_WEAK (vnode->decl) + || TREE_PUBLIC (vnode->decl) || DECL_EXTERNAL (vnode->decl)); + /* In several cases declarations can not be common: + + - when declaration has initializer + - when it is in weak + - when it has specific section + - when it resides in non-generic address space. + - if declaration is local, it will get into .local common section + so common flag is not needed. Frontends still produce these in + certain cases, such as for: + + static int a __attribute__ ((common)) + + Canonicalize things here and clear the redundant flag. */ + if (DECL_COMMON (vnode->decl) + && (!(TREE_PUBLIC (vnode->decl) || DECL_EXTERNAL (vnode->decl)) + || (DECL_INITIAL (vnode->decl) + && DECL_INITIAL (vnode->decl) != error_mark_node) + || DECL_WEAK (vnode->decl) + || DECL_SECTION_NAME (vnode->decl) != NULL + || ! (ADDR_SPACE_GENERIC_P + (TYPE_ADDR_SPACE (TREE_TYPE (vnode->decl)))))) + DECL_COMMON (vnode->decl) = 0; + } for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed) { if (!vnode->finalized) continue; - gcc_assert ((!DECL_WEAK (vnode->decl) && !DECL_COMMON (vnode->decl)) - || TREE_PUBLIC (vnode->decl) || DECL_EXTERNAL (vnode->decl)); if (vnode->needed && (DECL_COMDAT (vnode->decl) || TREE_PUBLIC (vnode->decl)) && (!whole_program |