public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch commmitted: Don't crash on empty print call
@ 2015-08-20 18:05 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2015-08-20 18:05 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

This patch by Chris Manghane fixes the Go frontend to not crash on an
empty print call ("print()").  An empty print call is useless as it
does nothing, but of course we shouldn't crash.  This fixes
https://golang.org/issue/11526 .  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1151 bytes --]

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 227037)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@
-ec34cfb0b148ff461df12c8f5270a06e2f438b7c
+cc7303c97b232ea979cab950d95aaf76c4e0f5b5
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc	(revision 226846)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -8177,6 +8177,12 @@ Builtin_call_expression::do_get_backend(
                                                       location);
 	  }
 
+        // There aren't any arguments to the print builtin.  The compiler
+        // issues a warning for this so we should avoid getting the backend
+        // representation for this call.  Instead, perform a no-op.
+        if (print_stmts == NULL)
+          return context->backend()->boolean_constant_expression(false);
+
         return print_stmts->get_backend(context);
       }
 

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

only message in thread, other threads:[~2015-08-20 17:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-20 18:05 Go patch commmitted: Don't crash on empty print call Ian Lance Taylor

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).