public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* [jit] Fix error-handling within gcc::jit::context::compile (timevar issues)
@ 2013-01-01  0:00 David Malcolm
  0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2013-01-01  0:00 UTC (permalink / raw)
  To: gcc-patches, jit; +Cc: David Malcolm

Committed to dmalcolm/jit:

gcc/jit/
	* internal-api.c (gcc::jit::context::compile): Correctly cleanup
	timevars in error-handling, preventing an issue where an error
	on a context left timevar.c in an unstopped state, leading to an
	assertion failure when restarting timevars in the next compile.
	Found via fuzz-testing.
---
 gcc/jit/ChangeLog.jit  |  8 ++++++++
 gcc/jit/internal-api.c | 13 +++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit
index adf273b..2cf5c8d 100644
--- a/gcc/jit/ChangeLog.jit
+++ b/gcc/jit/ChangeLog.jit
@@ -1,5 +1,13 @@
 2013-10-21  David Malcolm  <dmalcolm@redhat.com>
 
+	* internal-api.c (gcc::jit::context::compile): Correctly cleanup
+	timevars in error-handling, preventing an issue where an error
+	on a context left timevar.c in an unstopped state, leading to an
+	assertion failure when restarting timevars in the next compile.
+	Found via fuzz-testing.
+
+2013-10-21  David Malcolm  <dmalcolm@redhat.com>
+
 	* internal-api.c (gcc::jit::context::postprocess): Show source
 	line numbers (if any) in gimple dump.
 
diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c
index 8bb6741..d90f001 100644
--- a/gcc/jit/internal-api.c
+++ b/gcc/jit/internal-api.c
@@ -1261,7 +1261,11 @@ compile ()
   active_jit_ctxt = NULL;
 
   if (errors_occurred ())
-    goto error;
+    {
+      timevar_stop (TV_TOTAL);
+      timevar_print (stderr);
+      goto error;
+    }
 
   timevar_push (TV_ASSEMBLE);
 
@@ -1279,7 +1283,12 @@ compile ()
       printf ("cmd: %s\n", cmd);
     int ret = system (cmd);
     if (ret)
-      goto error;
+      {
+	timevar_pop (TV_ASSEMBLE);
+	timevar_stop (TV_TOTAL);
+	timevar_print (stderr);
+	goto error;
+      }
   }
   timevar_pop (TV_ASSEMBLE);
 
-- 
1.7.11.7

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-21 18:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-01  0:00 [jit] Fix error-handling within gcc::jit::context::compile (timevar issues) David Malcolm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).