-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: walkConvInterface produces broken IR [1.19 backport] #56770
Comments
@cuonglm Hello! Could you please provide rationale as per https://go.dev/wiki/MinorReleases? |
Hi @toothrot, I did add the rationale in the issue description:
|
Change https://go.dev/cl/451875 mentions this issue: |
Similar to #56744 , we'd need better understanding to decide whether we should backport this. Thanks. |
Maybe other people understand this, but I'm confused by how we weren't covering this code path in |
Because after walkConvInterface produced bad IR, this bad IR is never typechecked, it's just pass to backend as-is. For OITAB, a generic pointer (*uintpr, *int32 ...) would satisfy the backend. There're many places in the walk pass that we produce an ir.Node then call SetTypecheck(1), instead of calling typecheck.{Stmt,Expr} on generated node. |
Ah, so just to clarify further, we were taking that code path in |
Yes. The problem is more hidden for walkConvInterface, since the bad IR is put into init nodes, so it's harder to trigger the bug. Only until the fix to order slice literal, walkStmtList is called on init nodes, the missing typecheck bug was reveal. Then to fix the missing typecheck bug, typecheck.Stmts was called, which reveal the type mismatch in itab assignment. |
discussed at the weekly meeting, approved |
Closed by merging 5758a14 to release-branch.go1.19. |
For implementing interface to empty interface conversion, the compiler generate code like: var res *uint8 res = itab if res != nil { res = res.type } However, itab has type *uintptr, so the assignment is broken. The problem is not shown up, until CL 450215, which call typecheck on this broken assignment. To fix this, just cast itab to *uint8 when doing the conversion. Fixes #56770 Change-Id: Id42792d18e7f382578b40854d46eecd49673792c Reviewed-on: https://go-review.googlesource.com/c/go/+/451256 Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/451875 Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Joedian Reid <joedian@golang.org>
@cuonglm requested issue #56768 to be considered for backport to the next 1.19 minor release.
Some static initialization code causes the compiler to crash.
The text was updated successfully, but these errors were encountered: