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

memory corruption on linux/386 with float32 arithmetic, GO386=387, buildmode pie/c-archive [1.14 backport] #41619

gopherbot opened this issue Sep 24, 2020 · 3 comments


Copy link

@gopherbot gopherbot commented Sep 24, 2020

@randall77 requested issue #41503 to be considered for backport to the next 1.14 minor release.

@gopherbot Please open backport issues.

Copy link

@randall77 randall77 commented Sep 24, 2020

This is a compiler bug that causes arbitrary corruption at the intersection of 387, PIE, and float32.
It's been a bug forever (at least 1.10, probably earlier). I request a backport because 387 is going away for 1.16, so there's no path for anyone to get this fix otherwise.

Copy link

@gopherbot gopherbot commented Sep 24, 2020

Change mentions this issue: [release-branch.go1.14] cmd/compile: prevent 387+float32+pie from clobbering registers

gopherbot pushed a commit that referenced this issue Oct 1, 2020
…bbering registers

The 387 port needs to load a floating-point control word from a
global location to implement float32 arithmetic.
When compiling with -pie, loading that control word clobbers an
integer register. If that register had something important in it, boom.

Fix by using LEAL to materialize the address of the global location
first. LEAL with -pie works because the destination register is
used as the scratch register.

387 support is about to go away (#40255), so this will need to be
backported to have any effect.

No test. I have one, but it requires building with -pie, which
requires cgo. Our testing infrastructure doesn't make that easy.
Not worth it for a port which is about to vanish.

Fixes #41619

Change-Id: I140f9fc8fdce4e74a52c2c046e2bd30ae476d295
Run-TryBot: Keith Randall <>
Reviewed-by: Cherry Zhang <>
Reviewed-by: Matthew Dempsky <>
TryBot-Result: Go Bot <>
Trust: Keith Randall <>
(cherry picked from commit ea106cc)
Copy link

@gopherbot gopherbot commented Oct 1, 2020

Closed by merging fe30482 to release-branch.go1.14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.