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

cmd/compile: unnecessary padding in stack frames #42386

randall77 opened this issue Nov 5, 2020 · 1 comment

cmd/compile: unnecessary padding in stack frames #42386

randall77 opened this issue Nov 5, 2020 · 1 comment


Copy link

@randall77 randall77 commented Nov 5, 2020

In cmd/compile/internal/gc/pgen.go:185, we do:

		if thearch.LinkArch.InFamily(sys.MIPS, sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) {
			s.stksize = Rnd(s.stksize, int64(Widthptr))

This code originated in commit 2ac375b (then called cmd/gc/pgen.c:474, committed by Luuk van Dijk).

		if(thechar == '5')
			stksize = rnd(stksize, widthptr);

There's no indication why this code was added. I suspect it is not necessary (maybe it was, but is no longer). This issue is to investigate why we do this and whether we can remove it.

Reported on go-nuts by Eric from arm.

For a simple repro, compile

package main

func g()
func f(p, q *int16) {
	x := *p
	y := *q
	*p = y
	*q = x

The autotmps should be 2 bytes apart, not 8. They are 2 bytes apart on amd64, but not arm64.

Copy link

@ianlancetaylor ianlancetaylor commented Nov 5, 2020

Dup of #42385.


@golang golang locked and limited conversation to collaborators Nov 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants