This patch from Chris Manghane changes the Go frontend to avoid moving
nil subexpressions into temporary variables. This fixes GCC PR 61254,
a compiler crash on some rather unlikely, but valid, code.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.
Ian
diff -r f557f41e0008 go/statements.cc
--- a/go/statements.cc Fri Dec 12 17:00:18 2014 -0800
+++ b/go/statements.cc Fri Dec 12 17:40:13 2014 -0800
@@ -677,7 +677,8 @@
{
if (this->skip_ > 0)
--this->skip_;
- else if ((*pexpr)->temporary_reference_expression() == NULL)
+ else if ((*pexpr)->temporary_reference_expression() == NULL
+ && !(*pexpr)->is_nil_expression())
{
Location loc = (*pexpr)->location();
Temporary_statement* temp = Statement::make_temporary(NULL, *pexpr, loc);