]> gcc.gnu.org Git - gcc.git/commitdiff
ipa-fnsummary.c: fix use-after-free crash (PR jit/82826)
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 6 Nov 2017 16:31:04 +0000 (16:31 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Mon, 6 Nov 2017 16:31:04 +0000 (16:31 +0000)
gcc/ChangeLog:
PR jit/82826
* ipa-fnsummary.c (ipa_fnsummary_c_finalize): New function.
* ipa-fnsummary.h (ipa_fnsummary_c_finalize): New decl.
* toplev.c: Include "ipa-fnsummary.h".
(toplev::finalize): Call ipa_fnsummary_c_finalize.

From-SVN: r254458

gcc/ChangeLog
gcc/ipa-fnsummary.c
gcc/ipa-fnsummary.h
gcc/toplev.c

index 7c04aa9b313180bb1de907bc84a0e1c2d442f8f6..9c3961a9f19f3cddfcbc47326094fff70ae98f3f 100644 (file)
@@ -1,3 +1,11 @@
+2017-11-06  David Malcolm  <dmalcolm@redhat.com>
+
+       PR jit/82826
+       * ipa-fnsummary.c (ipa_fnsummary_c_finalize): New function.
+       * ipa-fnsummary.h (ipa_fnsummary_c_finalize): New decl.
+       * toplev.c: Include "ipa-fnsummary.h".
+       (toplev::finalize): Call ipa_fnsummary_c_finalize.
+
 2017-11-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/82838
index f6841104a32a5f87e507dca460e09a278edbe874..5168886fe1472322a9ebf079afeab2910ac69000 100644 (file)
@@ -3619,3 +3619,12 @@ make_pass_ipa_fn_summary (gcc::context *ctxt)
 {
   return new pass_ipa_fn_summary (ctxt);
 }
+
+/* Reset all state within ipa-fnsummary.c so that we can rerun the compiler
+   within the same process.  For use by toplev::finalize.  */
+
+void
+ipa_fnsummary_c_finalize (void)
+{
+  ipa_free_fn_summary ();
+}
index a794bd09318f136a76507fccd3161a8712c1c703..b345bbc4fd7e75c0ff8bfa79c0c7619e16de1864 100644 (file)
@@ -266,4 +266,6 @@ void estimate_node_size_and_time (struct cgraph_node *node,
                                  vec<inline_param_summary>
                                  inline_param_summary);
 
+void ipa_fnsummary_c_finalize (void);
+
 #endif /* GCC_IPA_FNSUMMARY_H */
index 81a7cf6b7dcb55f8b2ea107fc0de28d51c799704..eff169008d1326428304392313fc0c0d821873d2 100644 (file)
@@ -83,6 +83,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "edit-context.h"
 #include "tree-pass.h"
 #include "dumpfile.h"
+#include "ipa-fnsummary.h"
 
 #if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
 #include "dbxout.h"
@@ -2236,6 +2237,7 @@ toplev::finalize (void)
 
   /* Needs to be called before cgraph_c_finalize since it uses symtab.  */
   ipa_reference_c_finalize ();
+  ipa_fnsummary_c_finalize ();
 
   cgraph_c_finalize ();
   cgraphunit_c_finalize ();
This page took 0.116954 seconds and 5 git commands to generate.