-
Notifications
You must be signed in to change notification settings - Fork 18k
go/internal/gccgoimporter: nil type when decoding a type alias #27856
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
Comments
I can take a look at this. Looking at the export data in the object file I see
which as far as I can tell includes the alias 'E' in the right way (assuming that I'm not missing some other problem). I'll poke around on the decode side. |
@thanm Please let me know if you want me to look at this - I'm leaving this alone unless I hear otherwise from you. |
OK, I am fairly certain this is a bug in the decoder/parser (e.g. gccgoimporter/parser.go). Here is the type of interest: type <type 1 "E" = <type 2 "F" <type 3 struct { .test._ <type 4 *<type 5 "M" <type 6 struct { E <type 1>; }>>>; }>>>; parseNamedType() has code that looks for the '=' token (indicates an alias) in parser.go line 390:
The problem here is that the parseType call on line 393 (marked above) can include types that refer to the index of the alias type -- at that point there won't yet be an entry in typeMap for the type. There has to be some sort of entry in the map for "n" before this call is made. |
@griesemer looks like our comments crossed. Yes, if you could please look at it that would be great. |
For the record, to get the export data (.gox file) outside blaze, for a file x.go:
with x.gox containing the export data. |
Definitively a parser bug (which was not written with aliases in mind...). |
Change https://golang.org/cl/137857 mentions this issue: |
The fix above is for the std library. This needs to be back-ported to x/tools afterwards. |
Change https://golang.org/cl/137995 mentions this issue: |
This CL brings over the following changes from the std lib: https://golang.org/cl/137857 https://golang.org/cl/137935 https://golang.org/cl/137975 There are no further code changes except that the importer test cases are split between importer_test.go and importer19_test.go to support multiple Go versions. Updates golang/go#27856. Change-Id: I625def738c22c24c6659af37c3871038fdd8b981 Reviewed-on: https://go-review.googlesource.com/137995 Reviewed-by: Ian Lance Taylor <iant@golang.org>
The export data produced by gccgo for this Go package, when decoded by the gccgoexportdata package in x/tools, contains a nil type for the type alias, E. I'm not sure if the problem is on the encoding or decoding side, but it is breaking the blaze build for gccgo (b/116516363).
I have attached a standalone Go program containing the export data file produced by Blaze (as a string literal) to exercise the decode side:
gccgoimport.txt
Excerpt:
I'm not sure how to isolate the encode side, outside of Blaze.
The text was updated successfully, but these errors were encountered: