This patch by Chris Manghane fixes the Go frontend so that when moving
expressions to ensure that they are evaluated in the correct order, it
does not bother to move a constant expression. This fixes
https://golang.org/issue/11039 . 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 226123)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-cbb27e8089e11094a20502e53ef69c9c36955f85
+ac462880e803a926005f1756b0f8d82ff0c47499
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: gcc/go/gofrontend/statements.cc
===================================================================
--- gcc/go/gofrontend/statements.cc (revision 225750)
+++ gcc/go/gofrontend/statements.cc (working copy)
@@ -689,7 +689,8 @@ Move_subexpressions::expression(Expressi
if (this->skip_ > 0)
--this->skip_;
else if ((*pexpr)->temporary_reference_expression() == NULL
- && !(*pexpr)->is_nil_expression())
+ && !(*pexpr)->is_nil_expression()
+ && !(*pexpr)->is_constant())
{
Location loc = (*pexpr)->location();
Temporary_statement* temp = Statement::make_temporary(NULL, *pexpr, loc);