Skip to content
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: panic: First time we've seen filename (part II) #35652

Closed
ALTree opened this issue Nov 17, 2019 · 2 comments
Closed

cmd/compile: panic: First time we've seen filename (part II) #35652

ALTree opened this issue Nov 17, 2019 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Nov 17, 2019

$ gotip version
go version devel +6ba0be1639 Sat Nov 16 20:31:45 2019 +0000 linux/amd64

The following code (minimized from a gosmith-generated program):

package p

func f() {
	for true {
		if true {
			continue
		}
	}
}

crashes the tip compiler with this error:

$ gotip build crash.go 

# command-line-arguments
panic: First time we've seen filename: "gofile..??"

goroutine 49 [running]:
cmd/internal/obj.(*Link).generateDebugLinesSymbol(0xc000378ea0, 0xc000553d00, 0xc000553f00)
	/home/alberto/go/src/cmd/internal/obj/dwarf.go:43 +0x8e3
cmd/internal/obj.(*Link).populateDWARF(0xc000378ea0, 0xe40dc0, 0xc000166160, 0xc000553d00, 0x7fff3ca56300, 0x16)
	/home/alberto/go/src/cmd/internal/obj/objfile.go:619 +0x31c
cmd/internal/obj.Flushplist(0xc000378ea0, 0xc00058bea8, 0xc000048250, 0x7fff3ca56300, 0x16)
	/home/alberto/go/src/cmd/internal/obj/plist.go:112 +0x7d8
cmd/compile/internal/gc.(*Progs).Flush(0xc00058c1c0)
	/home/alberto/go/src/cmd/compile/internal/gc/gsubr.go:94 +0xbc
cmd/compile/internal/gc.compileSSA(0xc000166160, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:323 +0x690
cmd/compile/internal/gc.compileFunctions.func2(0xc000554d20, 0xc0005560f0, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:363 +0x49
created by cmd/compile/internal/gc.compileFunctions
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:361 +0x128

It compiles fine on Go1.13.4.

This appears to be related to the compiler crash previously reported in #34520.

cc @cherrymui @aclements @randall77

@ALTree ALTree added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Nov 17, 2019
@ALTree ALTree added this to the Go1.14 milestone Nov 17, 2019
@dr2chase dr2chase self-assigned this Nov 18, 2019
@gopherbot
Copy link

Change https://golang.org/cl/207613 mentions this issue: cmd/compile: make a better bogus line for empty infinite loops

@gopherbot
Copy link

Change https://golang.org/cl/207964 mentions this issue: cmd/compile: try harder to not use an empty src.XPos for a bogus line

gopherbot pushed a commit that referenced this issue Nov 22, 2019
The fix for #35652 did not guarantee that it was using a non-empty
src position to replace an empty one.  The new code checks again
and falls back to a more certain position.  (The input in question
compiles to a single empty infinite loop, and none of the actual instructions
had any source position at all.  That is a bug, but given the pathology
of this input, not one worth dealing with this late in the release cycle,
if ever.)

Literally:

00000 (5) TEXT "".f(SB), ABIInternal
00001 (5) PCDATA $0, $-2
00002 (5) PCDATA $1, $-2
00003 (5) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
00004 (5) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
00005 (5) FUNCDATA $2, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
b2
00006 (?) XCHGL AX, AX
b6
00007 (+1048575) JMP 6
00008 (?) END

TODO: Add runtime.InfiniteLoop(), replace infinite loops with a call to
that, and use an eco-friendly runtime.gopark instead.  (This was Cherry's
excellent idea.)

Updates #35652
Fixes #35695

Change-Id: I4b9a841142ee4df0f6b10863cfa0721a7e13b437
Reviewed-on: https://go-review.googlesource.com/c/go/+/207964
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
@golang golang locked and limited conversation to collaborators Nov 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

3 participants