New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gccgo: double evaluation in interface field expression #26248
Comments
The generated AST is
The Set_and_use_temporary_expression I wonder whether If |
A
|
Change https://golang.org/cl/122756 mentions this issue: |
I sent a CL to fix this. I'll look into other uses of Set_and_use_temporary_expression, see if they also have this issue and if we can avoid them. Thanks, @ianlancetaylor. |
Change https://golang.org/cl/122757 mentions this issue: |
The fix is CL 122756. Updates #26248. Change-Id: Ic4250ab5d01da9f65d0bc033e2306343d9c87a99 Reviewed-on: https://go-review.googlesource.com/122757 Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
In Interface_field_reference_expression, the interface expression is used in two places, so a temporary variable is used. Previously, we used a Set_and_use_temporary_expression, which, when evaluated twice, causes double evaluation of the underlying expression. Fix by setting the temporary once and use Temporary_reference_expression instead. Fixes golang/go#26248. Reviewed-on: https://go-review.googlesource.com/122756 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262533 138bc75d-0d04-0410-961f-82ee72b054a4
Change https://golang.org/cl/125097 mentions this issue: |
What version of Go are you using (
go version
)?go version go1.10.3 gccgo (GCC) 9.0.0 20180622 (experimental) linux/amd64
What did you do?
What did you expect to see?
What did you see instead?
It generates two calls to
G
inF
, one in nil check, one in constructing the func valueG().M
.The text was updated successfully, but these errors were encountered: