Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
gccgo: dereference of nil pointer to zero-width type does not panic #31151
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:
The problem seems not specific to zero-sized type.
This also does not panic. I think as long as the type is not big (>4096 bytes), if the backend somehow optimizes the dereference away, it will not panic.