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

go/types, types2: array size computation may overflow to 0 #59207

Closed
griesemer opened this issue Mar 23, 2023 · 2 comments
Closed

go/types, types2: array size computation may overflow to 0 #59207

griesemer opened this issue Mar 23, 2023 · 2 comments
Assignees
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@griesemer
Copy link
Contributor

package p

import "unsafe"

type E [1 << 32]byte
var a [1<<32]E

func _() {
	trace(unsafe.Sizeof(a))
}

go test -run Manual -- x.go produces

x.go:9:8: unsafe.Sizeof(a) (constant 0 of type uintptr)
@griesemer griesemer added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 23, 2023
@griesemer griesemer added this to the Go1.21 milestone Mar 23, 2023
@griesemer griesemer self-assigned this Mar 23, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/478921 mentions this issue: go/types, types2: make sure array sizes don't overflow to 0

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/478919 mentions this issue: cmd/compile: don't panic if unsafe.Sizeof/Offsetof is used with oversize types

@golang golang locked and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants