-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
go/types: uncommon pointer sizes result in an assertion failure #61249
Comments
Looks like that assertion was added in CL 478919 (attn @griesemer @findleyr). |
Change https://go.dev/cl/508821 mentions this issue: |
I think we can just remove this assertion. I grepped and believe this is the only such assertion, but @aykevl is that easy for you to confirm, by re-running your program without the problematic assertion? |
Yes, this appears to be the only assert. My tests pass after I remove that assert. |
Agreed that it's ok to remove this assert. |
As described in golang#61249, uncommon pointer sizes do exist. Remove an unnecessary assertion. Fixes golang#61249 Change-Id: Ib15857bd6bcd42ec530817a132bb8db036236c3b Reviewed-on: https://go-review.googlesource.com/c/go/+/508821 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, both on the master branch and on the latest release candidate (Go 1.21-rc2).
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I made a standalone reproducer here: https://github.com/aykevl/sandbox/tree/main/types2-avr
Simply pull the repository and run it using
go run .
.(The code is a quick-n-dirty modification of an example in go/types with the
Sizes
implementation copied from TinyGo - just enough for a standalone demonstration of the bug).What did you expect to see?
It should parse the file correctly, like it did in Go 1.20.
What did you see instead?
While typechecking, the program crashes with the following stack trace:
stack trace
Apparently the following assert is being hit:
go/src/go/types/const.go
Line 77 in 5c15498
I'd guess that the code assumes that pointers must always be either 4 or 8 bytes in size, while I'm compiling Go code for a system with 2-byte pointers (as crazy as that may sound, it does in fact work - in Go 1.20 at least). Specifically, this is for AVR microcontrollers which are mostly 8-bit but have 16-bit pointers.
Some more context: I'm in the process of making TinyGo work with Go 1.21 but this is one of various issues I'm hitting: tinygo-org/tinygo#3824
The text was updated successfully, but these errors were encountered: