Commit 0e0a1359 by Martin Jambor Committed by Martin Jambor

re PR tree-optimization/43257 (IPA-SRA changes DECL_ASSEMBLER_NAME)

2010-03-11  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43257
	* tree.c (assign_assembler_name_if_neeeded): New function.
	(free_lang_data_in_cgraph): Assembler name assignment moved to the
	above new function.
	* tree.h (assign_assembler_name_if_neeeded): Declare.
	* cgraphunit.c (cgraph_analyze_function): Create an assembler name for
	the function if needed.

	* testsuite/g++.dg/torture/pr43257.C: New test.

From-SVN: r157393
parent 1d9edd01
2010-03-11 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/43257
* tree.c (assign_assembler_name_if_neeeded): New function.
(free_lang_data_in_cgraph): Assembler name assignment moved to the
above new function.
* tree.h (assign_assembler_name_if_neeeded): Declare.
* cgraphunit.c (cgraph_analyze_function): Create an assembler name for
the function if needed.
2010-03-11 Chris Demetriou <cgd@google.com> 2010-03-11 Chris Demetriou <cgd@google.com>
* Makefile.in (stmp-int-hdrs): Make include/unwind.h, * Makefile.in (stmp-int-hdrs): Make include/unwind.h,
......
...@@ -836,6 +836,8 @@ cgraph_analyze_function (struct cgraph_node *node) ...@@ -836,6 +836,8 @@ cgraph_analyze_function (struct cgraph_node *node)
current_function_decl = decl; current_function_decl = decl;
push_cfun (DECL_STRUCT_FUNCTION (decl)); push_cfun (DECL_STRUCT_FUNCTION (decl));
assign_assembler_name_if_neeeded (node->decl);
/* Make sure to gimplify bodies only once. During analyzing a /* Make sure to gimplify bodies only once. During analyzing a
function we lower it, which will require gimplified nested function we lower it, which will require gimplified nested
functions, so we can end up here with an already gimplified functions, so we can end up here with an already gimplified
......
2010-03-11 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/43257
* g++.dg/torture/pr43257.C: New test.
2010-03-11 Tobias Burnus <burnus@net-b.de> 2010-03-11 Tobias Burnus <burnus@net-b.de>
PR fortran/43228 PR fortran/43228
......
/* { dg-do assemble } */
class A {};
class B {};
static void *func (int n)
{
void *p;
if (p == 0) throw ::A ();
}
static void *func (int n, B const &)
{
try {
return func (n);
}
catch (::A const &) {
}
return func (n);
}
void *f1 (int n)
{
return func (n, B());
}
void *f2 (int n)
{
return func (n, B());
}
...@@ -4831,6 +4831,33 @@ find_decls_types_in_var (struct varpool_node *v, struct free_lang_data_d *fld) ...@@ -4831,6 +4831,33 @@ find_decls_types_in_var (struct varpool_node *v, struct free_lang_data_d *fld)
find_decls_types (v->decl, fld); find_decls_types (v->decl, fld);
} }
/* If T needs an assembler name, have one created for it. */
void
assign_assembler_name_if_neeeded (tree t)
{
if (need_assembler_name_p (t))
{
/* When setting DECL_ASSEMBLER_NAME, the C++ mangler may emit
diagnostics that use input_location to show locus
information. The problem here is that, at this point,
input_location is generally anchored to the end of the file
(since the parser is long gone), so we don't have a good
position to pin it to.
To alleviate this problem, this uses the location of T's
declaration. Examples of this are
testsuite/g++.dg/template/cond2.C and
testsuite/g++.dg/template/pr35240.C. */
location_t saved_location = input_location;
input_location = DECL_SOURCE_LOCATION (t);
decl_assembler_name (t);
input_location = saved_location;
}
}
/* Free language specific information for every operand and expression /* Free language specific information for every operand and expression
in every node of the call graph. This process operates in three stages: in every node of the call graph. This process operates in three stages:
...@@ -4880,26 +4907,7 @@ free_lang_data_in_cgraph (void) ...@@ -4880,26 +4907,7 @@ free_lang_data_in_cgraph (void)
now because free_lang_data_in_decl will invalidate data needed now because free_lang_data_in_decl will invalidate data needed
for mangling. This breaks mangling on interdependent decls. */ for mangling. This breaks mangling on interdependent decls. */
for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++) for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++)
if (need_assembler_name_p (t)) assign_assembler_name_if_neeeded (t);
{
/* When setting DECL_ASSEMBLER_NAME, the C++ mangler may emit
diagnostics that use input_location to show locus
information. The problem here is that, at this point,
input_location is generally anchored to the end of the file
(since the parser is long gone), so we don't have a good
position to pin it to.
To alleviate this problem, this uses the location of T's
declaration. Examples of this are
testsuite/g++.dg/template/cond2.C and
testsuite/g++.dg/template/pr35240.C. */
location_t saved_location = input_location;
input_location = DECL_SOURCE_LOCATION (t);
decl_assembler_name (t);
input_location = saved_location;
}
/* Traverse every decl found freeing its language data. */ /* Traverse every decl found freeing its language data. */
for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++) for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++)
......
...@@ -4720,6 +4720,8 @@ extern tree build_low_bits_mask (tree, unsigned); ...@@ -4720,6 +4720,8 @@ extern tree build_low_bits_mask (tree, unsigned);
extern tree tree_strip_nop_conversions (tree); extern tree tree_strip_nop_conversions (tree);
extern tree tree_strip_sign_nop_conversions (tree); extern tree tree_strip_sign_nop_conversions (tree);
extern tree lhd_gcc_personality (void); extern tree lhd_gcc_personality (void);
extern void assign_assembler_name_if_neeeded (tree);
/* In cgraph.c */ /* In cgraph.c */
extern void change_decl_assembler_name (tree, tree); extern void change_decl_assembler_name (tree, tree);
......
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