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: Compiler regression in Go 1.16 - internal compiler error: child dcl collision on symbol #44378
Comments
/cc @randall77 @griesemer |
CC @thanm |
Thanks, I'll take a look. |
This is definitely an oddball of a bug. The code in question is from https://github.com/unidoc/unipdf. For some reason, the author(s) of this code have run it through an obfuscating tool, which renames local variables and compacts a lot of code down into a single line. Here is the offending line of code in its original form: func (_bbfa *PdfColorCalRGB )ToInteger (bits int )[3]uint32 {_fdbd :=_ag .Pow (2,float64 (bits ))-1;return [3]uint32 {uint32 (_fdbd *_bbfa .A ()),uint32 (_fdbd *_bbfa .B ()),uint32 (_fdbd *_bbfa .C ())};};func (_affae *PdfAppender )replaceObject (_agaf ,_adgf _aa .PdfObject ){switch _cecg :=_agaf .(type ){case *_aa .PdfIndirectObject :_affae ._dcbb [_adgf ]=_cecg .ObjectNumber ;case *_aa .PdfObjectStream :_affae ._dcbb [_adgf ]=_cecg .ObjectNumber ;};}; The function that triggers the problem is "replaceObject" above; prior to 1.16 we would not inline this function (since it contains a type switch). Now that we're inlining, it exposes a problem in the DWARF-gen code. Here is a slightly smaller reproducer:
The problem lies with type switch in the A.r method. For this switch the compiler manufactures a new PAUTO named "x" for each arm of the switch. Ordinarily these variables would be given a unique source position (that of the line of the associated "case" clause), but here due to the obfuscation each of the temps is given the same line number. In the source code above, the variables do have different columns, but in the current implementation of the Go parser/lexer the maximum allowable column number is 255. As a result, the DWARF code winds up seeing two AUTO variables with the same name, file, line, and column (which it is not expecting). Given the late stage of 1.16, probably the best way to handle this is by detecting this sort of breakdown in the DWARF code, as opposed to trying to do anything with the parser's handling of columns. I'll work on putting together a CL. |
Change https://golang.org/cl/294289 mentions this issue: |
@gopherbot please consider this for backport to 1.16 |
Backport issue(s) opened: #44433 (for 1.16). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/294789 mentions this issue: |
Change https://golang.org/cl/295129 mentions this issue: |
It was fixed by CL 294289, for #44378. This is a different style of test that uses line directives instead of extremely long lines. Fixes #38698. Change-Id: I50a1585030978b35fffa9981d6ed96b99216dc3e Reviewed-on: https://go-review.googlesource.com/c/go/+/295129 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Go Bot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes. I believe this is the latest release. Whereas it did not occur in Go 1.12 - 1.15.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Nothing, i.e. successful compilation. As happens on prior Go version (1.15, 1.14, 1.13 tested).
What did you see instead?
This was originally reported in: unidoc/unipdf#437
The text was updated successfully, but these errors were encountered: