gotypes: fix argument size for signatures without return types (#212)
This fixes a bug in argument size calculation in the case where the function has no return values. Previously it was padding the argument struct to max alignment, but this only happens if there are return values following. Updates #191
This commit is contained in:
committed by
GitHub
parent
e70c62b254
commit
7de02518a2
15
tests/fixedbugs/issue191/asm.go
Normal file
15
tests/fixedbugs/issue191/asm.go
Normal file
@@ -0,0 +1,15 @@
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
. "github.com/mmcloughlin/avo/build"
|
||||
)
|
||||
|
||||
func main() {
|
||||
TEXT("Uint16", 0, "func(n uint16)")
|
||||
Doc("Uint16 tests argument size without return types.")
|
||||
RET()
|
||||
Generate()
|
||||
}
|
||||
4
tests/fixedbugs/issue191/doc.go
Normal file
4
tests/fixedbugs/issue191/doc.go
Normal file
@@ -0,0 +1,4 @@
|
||||
// Package issue191 tests for correct argument size for a function taking a
|
||||
// single uint16 argument. Prior to the fix, this test case triggered an asmdecl
|
||||
// error.
|
||||
package issue191
|
||||
5
tests/fixedbugs/issue191/issue191.s
Normal file
5
tests/fixedbugs/issue191/issue191.s
Normal file
@@ -0,0 +1,5 @@
|
||||
// Code generated by command: go run asm.go -out issue191.s -stubs stub.go. DO NOT EDIT.
|
||||
|
||||
// func Uint16(n uint16)
|
||||
TEXT ·Uint16(SB), $0-2
|
||||
RET
|
||||
9
tests/fixedbugs/issue191/issue191_test.go
Normal file
9
tests/fixedbugs/issue191/issue191_test.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package issue191
|
||||
|
||||
import "testing"
|
||||
|
||||
//go:generate go run asm.go -out issue191.s -stubs stub.go
|
||||
|
||||
func TestUint16(t *testing.T) {
|
||||
Uint16(42)
|
||||
}
|
||||
6
tests/fixedbugs/issue191/stub.go
Normal file
6
tests/fixedbugs/issue191/stub.go
Normal file
@@ -0,0 +1,6 @@
|
||||
// Code generated by command: go run asm.go -out issue191.s -stubs stub.go. DO NOT EDIT.
|
||||
|
||||
package issue191
|
||||
|
||||
// Uint16 tests argument size without return types.
|
||||
func Uint16(n uint16)
|
||||
Reference in New Issue
Block a user