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

bmkessler opened this Issue Feb 13, 2019 · 2 comments


None yet
3 participants
Copy link

bmkessler commented Feb 13, 2019

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

$ go version
go1.11.2 linux/amd64

Does this issue reproduce with the latest release?


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)

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.


This comment has been minimized.

Copy link

gopherbot commented Feb 13, 2019

Change mentions this issue: math/big: handle alias of cofactor inputs in GCD


This comment has been minimized.

Copy link

katiehockman commented Feb 15, 2019

@gopherbot gopherbot closed this in a73abca Feb 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.