From 4ae183a7833b09bb8699161335b8402e8de69322 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 18 Oct 2016 21:17:29 +0200 Subject: sys: fix StrConstType size and alignment The current code is probably a leftover from times when StrConstType itself implied an indirection (it was a pointer to the string). Now strconst it is lowered to PtrType[StrConstType], so its size is len of the string and align is 1. It is not possible to test it now, as it is always used with indirection, so static size and align do not affect struct layout. --- sys/decl.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/decl.go b/sys/decl.go index da121b9e7..89773b0dd 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -232,11 +232,11 @@ type StrConstType struct { } func (t StrConstType) Size() uintptr { - return ptrSize + return uintptr(len(t.Val)) } func (t StrConstType) Align() uintptr { - return t.Size() + return 1 } func (t StrConstType) InnerType() Type { -- cgit mrf-deployment