This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][LTO] Committed patch to fix a crash due to syntax error.


I have just commited this trivial patch to make
gimple_try_catch_may_fallthru more robust in the presence of syntax
errors in input.

-Doug

Index: gcc/gcc/ChangeLog.lto
===================================================================
--- gcc/gcc/ChangeLog.lto       (revision 140999)
+++ gcc/gcc/ChangeLog.lto       (working copy)
@@ -1,3 +1,8 @@
+2008-10-09  Doug Kwan  <dougkwan@google.com>
+
+       * gimple-low.c (gimple_try_catch_may_fallthru): Check for empty
+       clean-up GIMPLE sequence.
+
 2008-10-08 Rafael Espindola  <espindola@google.com>

        * lto-tree-in.h (lto_symtab_get_resolution): New.
Index: gcc/gcc/gimple-low.c
===================================================================
--- gcc/gcc/gimple-low.c        (revision 140999)
+++ gcc/gcc/gimple-low.c        (working copy)
@@ -453,6 +453,15 @@ gimple_try_catch_may_fallthru (gimple st
     return true;

   i = gsi_start (gimple_try_cleanup (stmt));
+
+  /* If we have a syntax error, the cleanup sequence can be empty.
+     Return FALSE instead of crashing the compiler.  */
+  if (gsi_end_p (i))
+    {
+      gcc_assert (errorcount);
+      return false;
+    }
+
   switch (gimple_code (gsi_stmt (i)))
     {
     case GIMPLE_CATCH:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]