Skip to content

cmd/compile: panic: Assigning a bogus line to XPos with no file #35695

@ALTree

Description

@ALTree
$ gotip version
go version devel +8cf5293caa Tue Nov 19 06:10:03 2019 +0000 windows/amd64

The following program:

package p

func g() {}

func f() {
	i := 0
	if true {
		i++
	}
	for true {
		continue
		g()
	}
}

crashes the tip compiler with this error:

$ gotip build crash.go

# command-line-arguments
panic: Assigning a bogus line to XPos with no file will cause mysterious downstream failures.

goroutine 21 [running]:
cmd/internal/src.XPos.WithBogusLine(...)
        D:/users/ZZZZZZ/alberto/other/temp/go/src/cmd/internal/src/xpos.go:76
cmd/compile/internal/gc.genssa(0xc000112420, 0xc000114e70)
        D:/users/ZZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/ssa.go:6047 +0x2f85
cmd/compile/internal/gc.compileSSA(0xc0001122c0, 0x1)
        D:/users/ZZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:308 +0x3ac
cmd/compile/internal/gc.compileFunctions.func2(0xc0003948a0, 0xc00009ea60, 0x1)
        D:/users/ZZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:363 +0x50
created by cmd/compile/internal/gc.compileFunctions
        D:/users/ZZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:361 +0x12f

It compiles fine on Go1.13.4.

This is related to #34520 and #35652; the crash message looks different because it was changed in 9bba63b.

cc @dr2chase

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions