-
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: determine root cause for compiler crash in #23823 #31872
Comments
@griesemer With:
Should the error message point to line 3 instead of line 7? Current workaround point the error to line 7 go/test/fixedbugs/issue23823.go Line 13 in 8b058cf
|
@cuonglm It would be better for the error to be on line 3, but I'm happy we're getting a reasonable error in the first place. Cyclic interfaces using alias types are likely not working correct in all cases; we need to fix the root problems first (non-trivial) before dealing with positioning of error messages. |
@griesemer Yay, I have a patch in my local, which does report the error at line 3, that's why I asked question above. I will send the CL when I found a way to explain it easily. |
@griesemer Hmm, I cleanup my patch, and the only change needed to fix this issue is set go/src/cmd/compile/internal/gc/typecheck.go Line 519 in 8b058cf
The change + workaround removed does pass all the tests + change in Since you said this should be a non-trivial change, I'm afraid I'm missing something. |
@cuonglm Sorry for being unclear: What I meant is that fixing correct handling of cycles with alias types is non-trivial in general. It may well be that this specific line number fix is trivial. |
@griesemer when enable typecheck tracing, I got completely different error, is it intended behavior?
|
@cuonglm No. Looks like tracing changes things, which it shouldn't. |
Change https://golang.org/cl/191540 mentions this issue: |
typecheck only set n.Type.Nod for declared type, and leave it nil for anonymous types, type alias. It leads to compiler crashes, because n.Type.Nod is nil at the time dowidth was called. Fixing it by set n.Type.Nod right after n.Type initialization if n.Op is OTYPE. When embedding interface cycles involve in type alias, it also helps pointing the error message to the position of the type alias declaration, instead of position of embedding interface. Fixes golang#31872 Change-Id: Ia18391e987036a91f42ba0c08b5506f52d07f683 Reviewed-on: https://go-review.googlesource.com/c/go/+/191540 Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
typecheck only set n.Type.Nod for declared type, and leave it nil for anonymous types, type alias. It leads to compiler crashes, because n.Type.Nod is nil at the time dowidth was called. Fixing it by set n.Type.Nod right after n.Type initialization if n.Op is OTYPE. When embedding interface cycles involve in type alias, it also helps pointing the error message to the position of the type alias declaration, instead of position of embedding interface. Fixes golang#31872 Change-Id: Ia18391e987036a91f42ba0c08b5506f52d07f683 Reviewed-on: https://go-review.googlesource.com/c/go/+/191540 Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
Reminder issue: #23823 documents a compiler crash for which we introduced a temp. fix. Fix root cause for the crash, and remove temp. work-around code (see align.go, dowith function).
The text was updated successfully, but these errors were encountered: