Skip to content

gccgo: dereference of nil pointer to zero-width type does not panic #31151

Open
@mdempsky

Description

@mdempsky

The Go spec says "For an operand x of pointer type *T, the pointer indirection *x denotes the variable of type T pointed to by x. If x is nil, an attempt to evaluate *x will cause a run-time panic."

This program correctly panics with cmd/compile, but does not with gccgo 8.0.0:

package main

func main() {
	var p *struct{}
	*p = *p
}

/cc @ianlancetaylor

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions