cmd/compile: error line number reported is incorrect if it appears after line 0xFFFFF #36850
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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
OutputWhat did you do?
Create a valid
.go
source file that has more than1048574
lines (0xFFFFF
). And add some "garbage" to the end of it to make it invalid, to make compilation fail. Attempting to build it (go build big.go
) or run it (go run big.go
) the go tool detects the error and displays an error message where the line number is capped at1048574
improperly, e.g.:Here's a simple Go app that creates a
big.go
file that has approximately twice as many rows (it has a raw string literal that has 2*0xFFFFF empty lines):If we decrease the generated number of lines, e.g.:
We get the proper line number (
10003
):What did you expect to see?
I expected the proper line number to be printed where the error is detected (
2*0xFFFFFF+3 = 2097153
):What did you see instead?
The displayed error line number is improperly capped at
1048574
:Note: This issue was reported on StackOverflow: https://stackoverflow.com/questions/59951140/go-compiler-error-line-number-is-incorrect
The text was updated successfully, but these errors were encountered: