This patch to the Go frontend stops putting constants passed to the predeclared print/println functions in temporaries. This was an accidental recent change when the printlock function was introduced. The print/println functions are unusual in that integer constants are treated as int64 or uint64 when necessary. Putting them in temporaries breaks that, forcing the constants to int, which means that the wrong thing happens on 32-bit systems. This fixes GCC PR 78145. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 241688) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -c353ffbe18d1538cac7f2a3fcefb846dbf1a6591 +919ef699fe56a9b40c2bd0df07ac1378ce4a7fab 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 241688) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -7193,7 +7193,7 @@ Builtin_call_expression::do_lower(Gogo*, pa != this->args()->end(); ++pa) { - if (!(*pa)->is_variable()) + if (!(*pa)->is_variable() && !(*pa)->is_constant()) { Temporary_statement* temp = Statement::make_temporary(NULL, *pa, loc);