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

math/big: incorrect handling of aliased inputs in GCD #30217

Closed
bmkessler opened this issue Feb 13, 2019 · 3 comments
Closed

math/big: incorrect handling of aliased inputs in GCD #30217

bmkessler opened this issue Feb 13, 2019 · 3 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.

Comments

@bmkessler
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
go1.11.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

Calculate the cofactors x, y using the input variables (a, b) to store the result

d.GCD(x, y, a, b) --> x = 1, y = -1 (correct)
d.GCD(a, b, a, b) --> a = 1, b = 1 (incorrect)
d.GCD(b, a, a, b) --> b = 1, a = -6 (incorrect)

https://play.golang.org/p/KwX7hGGIHu_k

What did you expect to see?

Correct results that match when independent x, y are used.

What did you see instead?

Incorrect results when x and y reference the input variables a, b.

@gopherbot
Copy link

Change https://golang.org/cl/162517 mentions this issue: math/big: handle alias of cofactor inputs in GCD

@katiehockman katiehockman added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Feb 15, 2019
@katiehockman
Copy link
Contributor

/cc @griesemer

@gopherbot
Copy link

Change https://golang.org/cl/168257 mentions this issue: math/big: add comprehensive aliasing tests (and minor fixes to Exp, Rand)

@golang golang locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

3 participants