From 866a6edb5f3cbc1127b1b5eab9ed8d57badd9b88 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Fri, 14 Sep 2018 21:36:51 +0200 Subject: [PATCH] compiler: fix word size for AVR Using a word size less than 4 led to typechecker errors. --- compiler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler.go b/compiler.go index 8946f01d5..75df202d4 100644 --- a/compiler.go +++ b/compiler.go @@ -139,10 +139,14 @@ func NewCompiler(pkgName, triple string, dumpSSA bool) (*Compiler, error) { func (c *Compiler) Parse(mainPath string, buildTags []string) error { tripleSplit := strings.Split(c.triple, "-") + wordSize := c.targetData.PointerSize() + if wordSize < 4 { + wordSize = 4 + } config := loader.Config{ TypeChecker: types.Config{ Sizes: &types.StdSizes{ - int64(c.targetData.PointerSize()), + int64(wordSize), int64(c.targetData.PrefTypeAlignment(c.i8ptrType)), }, },