diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2012-04-30 23:34:35 +0200 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2012-04-30 23:34:35 +0200 |
commit | 036c01022a1cfabeaf885a6485b6f25da329ee98 (patch) | |
tree | ce57d487e05cec03c2151c772f2cb79883c72c40 | |
parent | 24b2a15a832a4ada89c40badfe3742e5fe10891f (diff) | |
download | gcc-036c01022a1cfabeaf885a6485b6f25da329ee98.zip gcc-036c01022a1cfabeaf885a6485b6f25da329ee98.tar.gz gcc-036c01022a1cfabeaf885a6485b6f25da329ee98.tar.bz2 |
re PR middle-end/53136 (Use after free in ipa_make_edge_direct_to_target, cxx_printable_name_internal problem)
PR middle-end/53136
* ipa-prop.c (ipa_print_node_jump_functions): Wrap multiple
calls to cgraph_node_name in xstrdup.
(ipa_make_edge_direct_to_target): Ditto.
* cgraph.c (dump_cgraph_node): Ditto.
* tree-sra.c (convert_callers_for_node): Ditto.
* lto-symtab.c (lto_cgraph_replace_node): Ditto.
* ipa-cp.c (perhaps_add_new_callers): Ditto.
* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Ditto.
(cgraph_materialize_all_clones): Ditto.
* ipa-inline.c (report_inline_failed_reason): Ditto.
(want_early_inline_function_p): Ditto.
(edge_badness): Ditto.
(update_edge_key): Ditto.
(flatten_function): Ditto.
(ipa_inline): Ditto.
(inlinw_always_inline_functions): Ditto.
(early_inline_small_functions): Ditto.
From-SVN: r187001
-rw-r--r-- | gcc/ChangeLog | 21 | ||||
-rw-r--r-- | gcc/cgraph.c | 4 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 8 | ||||
-rw-r--r-- | gcc/ipa-cp.c | 5 | ||||
-rw-r--r-- | gcc/ipa-inline.c | 51 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 8 | ||||
-rw-r--r-- | gcc/lto-symtab.c | 4 | ||||
-rw-r--r-- | gcc/tree-sra.c | 4 |
8 files changed, 66 insertions, 39 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a020376..478ba87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,26 @@ 2012-04-30 Uros Bizjak <ubizjak@gmail.com> + PR middle-end/53136 + * ipa-prop.c (ipa_print_node_jump_functions): Wrap multiple + calls to cgraph_node_name in xstrdup. + (ipa_make_edge_direct_to_target): Ditto. + * cgraph.c (dump_cgraph_node): Ditto. + * tree-sra.c (convert_callers_for_node): Ditto. + * lto-symtab.c (lto_cgraph_replace_node): Ditto. + * ipa-cp.c (perhaps_add_new_callers): Ditto. + * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Ditto. + (cgraph_materialize_all_clones): Ditto. + * ipa-inline.c (report_inline_failed_reason): Ditto. + (want_early_inline_function_p): Ditto. + (edge_badness): Ditto. + (update_edge_key): Ditto. + (flatten_function): Ditto. + (ipa_inline): Ditto. + (inlinw_always_inline_functions): Ditto. + (early_inline_small_functions): Ditto. + +2012-04-30 Uros Bizjak <ubizjak@gmail.com> + PR target/53141 * config/i386/i386.md (*umul<mode><dwi>3_1): Switch places of constraints 0 and 1. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index ebba1b7..c765b31 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1476,9 +1476,9 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) if (node->global.inlined_to) fprintf (f, " Function %s/%i is inline copy in %s/%i\n", - cgraph_node_name (node), + xstrdup (cgraph_node_name (node)), node->symbol.order, - cgraph_node_name (node->global.inlined_to), + xstrdup (cgraph_node_name (node->global.inlined_to)), node->global.inlined_to->symbol.order); if (node->clone_of) fprintf (f, " Clone of %s/%i\n", diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index f922a5e..ee69afa 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2146,8 +2146,8 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e) if (cgraph_dump_file) { fprintf (cgraph_dump_file, "updating call of %s/%i -> %s/%i: ", - cgraph_node_name (e->caller), e->caller->uid, - cgraph_node_name (e->callee), e->callee->uid); + xstrdup (cgraph_node_name (e->caller)), e->caller->uid, + xstrdup (cgraph_node_name (e->callee)), e->callee->uid); print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags); if (e->callee->clone.combined_args_to_skip) { @@ -2233,8 +2233,8 @@ cgraph_materialize_all_clones (void) if (cgraph_dump_file) { fprintf (cgraph_dump_file, "cloning %s to %s\n", - cgraph_node_name (node->clone_of), - cgraph_node_name (node)); + xstrdup (cgraph_node_name (node->clone_of)), + xstrdup (cgraph_node_name (node))); if (node->clone.tree_map) { unsigned int i; diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 4826c58..eb8d20d 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2180,8 +2180,9 @@ perhaps_add_new_callers (struct cgraph_node *node, struct ipcp_value *val) if (dump_file) fprintf (dump_file, " - adding an extra caller %s/%i" " of %s/%i\n", - cgraph_node_name (cs->caller), cs->caller->uid, - cgraph_node_name (val->spec_node), + xstrdup (cgraph_node_name (cs->caller)), + cs->caller->uid, + xstrdup (cgraph_node_name (val->spec_node)), val->spec_node->uid); cgraph_redirect_edge_callee (cs, val->spec_node); diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 451bd61..eb3d42d 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -220,8 +220,8 @@ report_inline_failed_reason (struct cgraph_edge *e) if (dump_file) { fprintf (dump_file, " not inlinable: %s/%i -> %s/%i, %s\n", - cgraph_node_name (e->caller), e->caller->uid, - cgraph_node_name (e->callee), e->callee->uid, + xstrdup (cgraph_node_name (e->caller)), e->caller->uid, + xstrdup (cgraph_node_name (e->callee)), e->callee->uid, cgraph_inline_failed_string (e->inline_failed)); } } @@ -423,8 +423,8 @@ want_early_inline_function_p (struct cgraph_edge *e) if (dump_file) fprintf (dump_file, " will not early inline: %s/%i->%s/%i, " "call is cold and code would grow by %i\n", - cgraph_node_name (e->caller), e->caller->uid, - cgraph_node_name (callee), callee->uid, + xstrdup (cgraph_node_name (e->caller)), e->caller->uid, + xstrdup (cgraph_node_name (callee)), callee->uid, growth); want_inline = false; } @@ -434,8 +434,8 @@ want_early_inline_function_p (struct cgraph_edge *e) if (dump_file) fprintf (dump_file, " will not early inline: %s/%i->%s/%i, " "callee is not leaf and code would grow by %i\n", - cgraph_node_name (e->caller), e->caller->uid, - cgraph_node_name (callee), callee->uid, + xstrdup (cgraph_node_name (e->caller)), e->caller->uid, + xstrdup (cgraph_node_name (callee)), callee->uid, growth); want_inline = false; } @@ -444,8 +444,8 @@ want_early_inline_function_p (struct cgraph_edge *e) if (dump_file) fprintf (dump_file, " will not early inline: %s/%i->%s/%i, " "growth %i exceeds --param early-inlining-insns\n", - cgraph_node_name (e->caller), e->caller->uid, - cgraph_node_name (callee), callee->uid, + xstrdup (cgraph_node_name (e->caller)), e->caller->uid, + xstrdup (cgraph_node_name (callee)), callee->uid, growth); want_inline = false; } @@ -754,8 +754,8 @@ edge_badness (struct cgraph_edge *edge, bool dump) if (dump) { fprintf (dump_file, " Badness calculation for %s -> %s\n", - cgraph_node_name (edge->caller), - cgraph_node_name (callee)); + xstrdup (cgraph_node_name (edge->caller)), + xstrdup (cgraph_node_name (callee))); fprintf (dump_file, " size growth %i, time growth %i\n", growth, time_growth); @@ -910,8 +910,10 @@ update_edge_key (fibheap_t heap, struct cgraph_edge *edge) { fprintf (dump_file, " decreasing badness %s/%i -> %s/%i, %i to %i\n", - cgraph_node_name (edge->caller), edge->caller->uid, - cgraph_node_name (edge->callee), edge->callee->uid, + xstrdup (cgraph_node_name (edge->caller)), + edge->caller->uid, + xstrdup (cgraph_node_name (edge->callee)), + edge->callee->uid, (int)n->key, badness); } @@ -925,8 +927,10 @@ update_edge_key (fibheap_t heap, struct cgraph_edge *edge) { fprintf (dump_file, " enqueuing call %s/%i -> %s/%i, badness %i\n", - cgraph_node_name (edge->caller), edge->caller->uid, - cgraph_node_name (edge->callee), edge->callee->uid, + xstrdup (cgraph_node_name (edge->caller)), + edge->caller->uid, + xstrdup (cgraph_node_name (edge->callee)), + edge->callee->uid, badness); } edge->aux = fibheap_insert (heap, badness, edge); @@ -1610,8 +1614,8 @@ flatten_function (struct cgraph_node *node, bool early) if (dump_file) fprintf (dump_file, "Not inlining %s into %s to avoid cycle.\n", - cgraph_node_name (callee), - cgraph_node_name (e->caller)); + xstrdup (cgraph_node_name (callee)), + xstrdup (cgraph_node_name (e->caller))); e->inline_failed = CIF_RECURSIVE_INLINING; continue; } @@ -1651,8 +1655,8 @@ flatten_function (struct cgraph_node *node, bool early) recursing through the original node if the node was cloned. */ if (dump_file) fprintf (dump_file, " Inlining %s into %s.\n", - cgraph_node_name (callee), - cgraph_node_name (e->caller)); + xstrdup (cgraph_node_name (callee)), + xstrdup (cgraph_node_name (e->caller))); orig_callee = callee; inline_call (e, true, NULL, NULL); if (e->callee != orig_callee) @@ -1754,7 +1758,8 @@ ipa_inline (void) { fprintf (dump_file, "\nInlining %s size %i.\n", - cgraph_node_name (node), inline_summary (node)->size); + cgraph_node_name (node), + inline_summary (node)->size); fprintf (dump_file, " Called once from %s %i insns.\n", cgraph_node_name (node->callers->caller), @@ -1817,8 +1822,8 @@ inline_always_inline_functions (struct cgraph_node *node) if (dump_file) fprintf (dump_file, " Inlining %s into %s (always_inline).\n", - cgraph_node_name (e->callee), - cgraph_node_name (e->caller)); + xstrdup (cgraph_node_name (e->callee)), + xstrdup (cgraph_node_name (e->caller))); inline_call (e, true, NULL, NULL); inlined = true; } @@ -1867,8 +1872,8 @@ early_inline_small_functions (struct cgraph_node *node) if (dump_file) fprintf (dump_file, " Inlining %s into %s.\n", - cgraph_node_name (callee), - cgraph_node_name (e->caller)); + xstrdup (cgraph_node_name (callee)), + xstrdup (cgraph_node_name (e->caller))); inline_call (e, true, NULL, NULL); inlined = true; } diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 97a6a5c..02d6c31 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -230,8 +230,8 @@ ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node) continue; fprintf (f, " callsite %s/%i -> %s/%i : \n", - cgraph_node_name (node), node->uid, - cgraph_node_name (cs->callee), cs->callee->uid); + xstrdup (cgraph_node_name (node)), node->uid, + xstrdup (cgraph_node_name (cs->callee)), cs->callee->uid); ipa_print_node_jump_functions_for_edge (f, cs); } @@ -1780,8 +1780,8 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target) fprintf (dump_file, "ipa-prop: Discovered %s call to a known target " "(%s/%i -> %s/%i), for stmt ", ie->indirect_info->polymorphic ? "a virtual" : "an indirect", - cgraph_node_name (ie->caller), ie->caller->uid, - cgraph_node_name (ie->callee), ie->callee->uid); + xstrdup (cgraph_node_name (ie->caller)), ie->caller->uid, + xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid); if (ie->call_stmt) print_gimple_stmt (dump_file, ie->call_stmt, 2, TDF_SLIM); else diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 12e1b95..a371c0a 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -215,8 +215,8 @@ lto_cgraph_replace_node (struct cgraph_node *node, { fprintf (cgraph_dump_file, "Replacing cgraph node %s/%i by %s/%i" " for symbol %s\n", - cgraph_node_name (node), node->uid, - cgraph_node_name (prevailing_node), + xstrdup (cgraph_node_name (node)), node->uid, + xstrdup (cgraph_node_name (prevailing_node)), prevailing_node->uid, IDENTIFIER_POINTER ((*targetm.asm_out.mangle_assembler_name) (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->symbol.decl))))); diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 70b241d..110990a 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4612,8 +4612,8 @@ convert_callers_for_node (struct cgraph_node *node, if (dump_file) fprintf (dump_file, "Adjusting call (%i -> %i) %s -> %s\n", cs->caller->uid, cs->callee->uid, - cgraph_node_name (cs->caller), - cgraph_node_name (cs->callee)); + xstrdup (cgraph_node_name (cs->caller)), + xstrdup (cgraph_node_name (cs->callee))); ipa_modify_call_arguments (cs, cs->call_stmt, adjustments); |