compiler: fix word size for AVR

Using a word size less than 4 led to typechecker errors.
Этот коммит содержится в:
Ayke van Laethem 2018-09-14 21:36:51 +02:00
родитель 327076da39
коммит 866a6edb5f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E97FF5335DFDFDED

Просмотреть файл

@ -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)),
},
},