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

fmt: panic on printing math.MinInt64 with %b format #3510

Closed
gopherbot opened this issue Apr 11, 2012 · 3 comments
Closed

fmt: panic on printing math.MinInt64 with %b format #3510

gopherbot opened this issue Apr 11, 2012 · 3 comments
Milestone

Comments

@gopherbot
Copy link

by leterip:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. fmt.Printf("%b", int64(math.MinInt64))

http://play.golang.org/p/wXVCE2mmka

What is the expected output?
A binary representation of the minimal int64 value.

What do you see instead?
panic: runtime error: index out of range

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
darwin

Which version are you using?  (run 'go version')
go version go1

Please provide any additional information below.
The problem exists on play.golang.org as well.
@rsc
Copy link
Contributor

rsc commented Apr 11, 2012

Comment 1:

Looks like nByte=64 needs to be a little bigger.

Labels changed: added priority-later, go1.1, removed priority-triage.

Owner changed to @robpike.

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Apr 12, 2012

Comment 2:

This issue was closed by revision a662d3d.

Status changed to Fixed.

@robpike
Copy link
Contributor

robpike commented Apr 25, 2012

Comment 3:

This issue was closed by revision c53d77bda4a7.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
robpike added a commit that referenced this issue May 11, 2015
««« backport 344d5c33331a
fmt: fix crash of %b on huge negative int64
The buffer had 64 bytes but needs one more for the sign.

Fixes #3510.

R=golang-dev, dave, dsymonds
CC=golang-dev
https://golang.org/cl/6011057
»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned robpike Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants