This patch to the Go frontend fixes a compiler crash if a compound
statement winds up doing nothing at all.  The test case is
http://codereview.appspot.com/124020044 and will go into the master Go
testsuite.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


2014-08-08  Ian Lance Taylor  <i...@google.com>

        * go-gcc.cc (Gcc_backend::compound_statement): Don't return
        NULL_TREE.


Index: go-gcc.cc
===================================================================
--- go-gcc.cc	(revision 213760)
+++ go-gcc.cc	(working copy)
@@ -2123,6 +2123,12 @@ Gcc_backend::compound_statement(Bstateme
   if (t == error_mark_node)
     return this->error_statement();
   append_to_statement_list(t, &stmt_list);
+
+  // If neither statement has any side effects, stmt_list can be NULL
+  // at this point.
+  if (stmt_list == NULL_TREE)
+    stmt_list = integer_zero_node;
+
   return this->make_statement(stmt_list);
 }
 

Reply via email to