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/internal/types2: don't crash if import path is missing #43190

Open
griesemer opened this issue Dec 15, 2020 · 1 comment
Open

cmd/compile/internal/types2: don't crash if import path is missing #43190

griesemer opened this issue Dec 15, 2020 · 1 comment
Assignees
Labels
Milestone

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Dec 15, 2020

The program main.go:

package p
import

causes a crash for types2 with go test -run Check$ -files main.go.

The problem is that the syntax parser returns nil *syntax.ImportDecl values when the import path is missing; and those nil values are added to decl lists even though they should be ignored.

@griesemer griesemer added the NeedsFix label Dec 15, 2020
@griesemer griesemer added this to the Go1.17 milestone Dec 15, 2020
@griesemer griesemer self-assigned this Dec 15, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 15, 2020

Change https://golang.org/cl/278114 mentions this issue: [dev.typeparams] cmd/compile/internal/types2: don't crash if import path is missing

gopherbot pushed a commit that referenced this issue Dec 15, 2020
…ath is missing

In package syntax:
- fix parser appendGroup to not add nil entries
- non-string paths are syntax errors per the spec; report in parser
- document ImportDecl.Path invariants

In package types2:
- guard against absent paths

In package gc:
- guard against absent paths

Fixes #43190.

Change-Id: Ic6a06f6a96b7f519feaa1ceaf4376fc5ab0f0129
Reviewed-on: https://go-review.googlesource.com/c/go/+/278114
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.