aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/api
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2023-02-15 10:21:52 -0800
committerKeith Randall <khr@golang.org>2023-02-17 03:56:57 +0000
commit21f434058cc989acfd32a05fab71d7e7fe5fb641 (patch)
tree3284796afc274152ae13684f221ef9426ea5a29e /src/cmd/api
parent031401a7905a38498fc399fc10cd0c1e885f7fc9 (diff)
downloadgo-21f434058cc989acfd32a05fab71d7e7fe5fb641.tar.xz
cmd/compile: ensure constant folding of pointer arithmetic remains a pointer
For c + nil, we want the result to still be of pointer type. Fixes ppc64le build failure with CL 468455, in issue33724.go. The problem in that test is that it requires a nil check to be scheduled before the corresponding load. This normally happens fine because we prioritize nil checks. If we have nilcheck(p) and load(p), once p is scheduled the nil check will always go before the load. The issue we saw in 33724 is that when p is a nil pointer, we ended up with two different p's, an int64(0) as the argument to the nil check and an (*Outer)(0) as the argument to the load. Those two zeroes don't get CSEd, so if the (*Outer)(0) happens to get scheduled first, the load can end up before the nilcheck. Fix this by always having constant arithmetic preserve the pointerness of the value, so that both zeroes are of type *Outer and get CSEd. Update #58482 Update #33724 Change-Id: Ib9b8c0446f1690b574e0f3c0afb9934efbaf3513 Reviewed-on: https://go-review.googlesource.com/c/go/+/468615 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> TryBot-Bypass: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/api')
0 files changed, 0 insertions, 0 deletions