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
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); }