Commit fccc4eb2 by Jan Hubicka Committed by Jan Hubicka

re PR rtl-optimization/12275 ([unit-at-a-time] ICE in htab_clear_slot)


	PR opt/12275
	* c-decl.c (finish_decl): Use change_decl_assembler_name.
	* c-pragma.c (handle_pragma_redefine_extname): Likewise.
	* varasm.c (make_decl_rtl): Likewise.
	* cgraph.c (change_decl_assembler_name): New function.
	* tree.h (set_decl_assembler_name): Kill dead declaration.
	(change_decl_assembler_name): Declare.

	* decl.c (make_rtl_for_nonlocal_decl): Use change_decl_assembler_name.
	* decl2.c (make_rtl_for_nonlocal_decl): Use change_decl_assembler_name.

From-SVN: r73532
parent 1b2b8ee7
2003-11-13 Jan Hubicka <jh@suse.cz>
PR opt/12275
* c-decl.c (finish_decl): Use change_decl_assembler_name.
* c-pragma.c (handle_pragma_redefine_extname): Likewise.
* varasm.c (make_decl_rtl): Likewise.
* cgraph.c (change_decl_assembler_name): New function.
* tree.h (set_decl_assembler_name): Kill dead declaration.
(change_decl_assembler_name): Declare.
* decl.c (make_rtl_for_nonlocal_decl): Use change_decl_assembler_name.
* decl2.c (make_rtl_for_nonlocal_decl): Use change_decl_assembler_name.
2003-11-12 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/lib1funcs.asm (___mulsi3): Don't save/restore
......
......@@ -2870,7 +2870,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
#endif
}
SET_DECL_RTL (decl, NULL_RTX);
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (starred));
change_decl_assembler_name (decl, get_identifier (starred));
}
/* If #pragma weak was used, mark the decl weak now. */
......@@ -2920,7 +2920,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
warning ("%Jignoring asm-specifier for non-static local "
"variable '%D'", decl, decl);
else
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec));
change_decl_assembler_name (decl, get_identifier (asmspec));
}
if (TREE_CODE (decl) != FUNCTION_DECL)
......
......@@ -382,7 +382,7 @@ handle_pragma_redefine_extname (cpp_reader *dummy ATTRIBUTE_UNUSED)
if (DECL_ASSEMBLER_NAME_SET_P (decl)
&& DECL_ASSEMBLER_NAME (decl) != newname)
warning ("#pragma redefine_extname conflicts with declaration");
SET_DECL_ASSEMBLER_NAME (decl, newname);
change_decl_assembler_name (decl, newname);
}
else
add_to_renaming_pragma_list(oldname, newname);
......
......@@ -428,8 +428,6 @@ cgraph_varpool_node (tree decl)
if (!cgraph_varpool_hash)
cgraph_varpool_hash = htab_create_ggc (10, cgraph_varpool_hash_node,
eq_cgraph_varpool_node, NULL);
slot = (struct cgraph_varpool_node **)
htab_find_slot_with_hash (cgraph_varpool_hash, DECL_ASSEMBLER_NAME (decl),
IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME (decl)),
......@@ -444,6 +442,84 @@ cgraph_varpool_node (tree decl)
return node;
}
/* Set the DECL_ASSEMBLER_NAME and update cgraph hashtables. */
void
change_decl_assembler_name (tree decl, tree name)
{
struct cgraph_node *node = NULL;
struct cgraph_varpool_node *vnode = NULL;
void **slot;
if (!DECL_ASSEMBLER_NAME_SET_P (decl))
{
SET_DECL_ASSEMBLER_NAME (decl, name);
return;
}
if (name == DECL_ASSEMBLER_NAME (decl))
return;
if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
warning ("%D renamed after being referenced in assembly", decl);
if (TREE_CODE (decl) == FUNCTION_DECL && cgraph_hash)
{
/* Take a look whether declaration is in the cgraph structure. */
slot =
htab_find_slot_with_hash (cgraph_hash, DECL_ASSEMBLER_NAME (decl),
IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME
(decl)), NO_INSERT);
if (slot)
node = *slot;
/* It is, verify that we are the canonical node for this decl. */
if (node && node->decl == decl)
{
node = *slot;
htab_clear_slot (cgraph_hash, slot);
}
else
node = NULL;
}
if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl) && cgraph_varpool_hash)
{
/* Take a look whether declaration is in the cgraph structure. */
slot =
htab_find_slot_with_hash (cgraph_varpool_hash, DECL_ASSEMBLER_NAME (decl),
IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME
(decl)), NO_INSERT);
if (slot)
vnode = *slot;
/* It is, verify that we are the canonical vnode for this decl. */
if (vnode && vnode->decl == decl)
{
vnode = *slot;
htab_clear_slot (cgraph_varpool_hash, slot);
}
else
vnode = NULL;
}
SET_DECL_ASSEMBLER_NAME (decl, name);
if (node)
{
slot =
htab_find_slot_with_hash (cgraph_hash, name,
IDENTIFIER_HASH_VALUE (name), INSERT);
if (*slot)
abort ();
*slot = node;
}
if (vnode)
{
slot =
htab_find_slot_with_hash (cgraph_varpool_hash, name,
IDENTIFIER_HASH_VALUE (name), INSERT);
if (*slot)
abort ();
*slot = vnode;
}
}
/* Try to find existing function for identifier ID. */
struct cgraph_varpool_node *
cgraph_varpool_node_for_identifier (tree id)
......
......@@ -4526,7 +4526,7 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
/* Set the DECL_ASSEMBLER_NAME for the variable. */
if (asmspec)
{
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec));
change_decl_assembler_name (decl, get_identifier (asmspec));
/* The `register' keyword, when used together with an
asm-specification, indicates that the variable should be
placed in a particular register. */
......
......@@ -1000,7 +1000,7 @@ grokfield (tree declarator, tree declspecs, tree init, tree asmspec_tree,
/* This must override the asm specifier which was placed
by grokclassfn. Lay this out fresh. */
SET_DECL_RTL (value, NULL_RTX);
SET_DECL_ASSEMBLER_NAME (value, get_identifier (asmspec));
change_decl_assembler_name (value, get_identifier (asmspec));
}
if (!DECL_FRIEND_P (value))
grok_special_member_properties (value);
......
2003-11-13 Jan Hubicka <jh@suse.cz>
* gcc.c-torture/compile/20031112-1.c: New test.
2003-11-12 Mark Mitchell <mark@codesourcery.com>
* g++.dg/parse/crash10.C: Remove bogus error marker.
......
extern __inline int __finite (double __value) { return 0; }
extern __typeof (__finite) __finite __asm__ ("" "__GI___finite");
......@@ -2712,7 +2712,7 @@ extern tree get_file_function_name_long (const char *);
extern tree get_set_constructor_bits (tree, char *, int);
extern tree get_set_constructor_bytes (tree, unsigned char *, int);
extern tree get_callee_fndecl (tree);
extern void set_decl_assembler_name (tree);
extern void change_decl_assembler_name (tree, tree);
extern int type_num_arguments (tree);
extern tree lhd_unsave_expr_now (tree);
......
......@@ -791,7 +791,7 @@ make_decl_rtl (tree decl, const char *asmspec)
char *starred = alloca (strlen (asmspec) + 2);
starred[0] = '*';
strcpy (starred + 1, asmspec);
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (starred));
change_decl_assembler_name (decl, get_identifier (starred));
}
name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
......
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