-
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
cmd/compile: internal compiler error: width not calculated: map[string]string #44895
Comments
CC @griesemer |
Yes, thanks for the simple example! I guess in rare cases we still need to do CheckSize in g.typ(), even though it shouldn't really be necessary - I think I should be able to figure out when exactly when/why this is needed. |
There's no real harm to extra calls to CheckSize, other than marginally extra CPU usage if we don't end up needing the type (e.g., dead code elimination or something). So feel free to liberally add them as needed to fix issues, as long as we add regress tests for them too. |
I'm leaning to the same fix as @mdempsky suggested, like what I did in https://go-review.googlesource.com/c/go/+/299689. It's safer to just include the check, because now we don't compile function immediately but pushing to queue and compile later instead. So there's no way to guarantee that the type size is calculated. Previously, it's ok to compute size during SSA generation, now it doesn't. |
While we didn't explicitly detect size calculations during non-concurrent SSA construction before, we also don't have any code that made us more aggressive about preemptively checking type sizes when concurrency was enabled. So any late size calculations that used to work, would have failed with concurrent compilations. We just don't have as much test coverage for concurrent compilation, and always using the compilation queue made those mistakes more visible. If we wanted to restore the old, lax behavior, then I think in gc/compile.go:compileFunctions we could leave types.CalcSizeDisabled and base.Ctxt.InParallel as false when base.Flag.LowerC is 1. In that case, while there are multiple goroutines compiling everything, all of the work is serialized on a 1-element semaphore. However, I'd lean towards keeping the failures noisy to help rooting them out and fixing them, rather than leaving them as latent issues for users that use concurrent compilation. |
Change https://golang.org/cl/300989 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputIn #43931 I've learned that I can use
gotip
to experiment with generic code and that (#43931 (comment))I'm using
on this piece of code:
What did you expect to see?
No error
What did you see instead?
The entire code is in https://github.com/andig/evcc/tree/go2/registry
The text was updated successfully, but these errors were encountered: