This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: In range, evaluate array if it has receives or calls


The recent patch to the Go frontend to not evaluate an array value in
a range statement with a single iteration variable was too aggressive.
The array value should be evaluated if the expression has any calls or
receive expressions.  This patch fixes that, reusing the existing code
that checks whether len/cap of an array is a constant.  This patch
also cleans up the use of _ as the second variable in a forrange; it
was previous inconsistent depending on whether the statement used = or
:=.  This is a follow-on to https://golang.org/issue/22313.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]