mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 10:43:29 +00:00
compiler: fix word size for AVR
Using a word size less than 4 led to typechecker errors.
This commit is contained in:
+5
-1
@@ -139,10 +139,14 @@ func NewCompiler(pkgName, triple string, dumpSSA bool) (*Compiler, error) {
|
|||||||
func (c *Compiler) Parse(mainPath string, buildTags []string) error {
|
func (c *Compiler) Parse(mainPath string, buildTags []string) error {
|
||||||
tripleSplit := strings.Split(c.triple, "-")
|
tripleSplit := strings.Split(c.triple, "-")
|
||||||
|
|
||||||
|
wordSize := c.targetData.PointerSize()
|
||||||
|
if wordSize < 4 {
|
||||||
|
wordSize = 4
|
||||||
|
}
|
||||||
config := loader.Config{
|
config := loader.Config{
|
||||||
TypeChecker: types.Config{
|
TypeChecker: types.Config{
|
||||||
Sizes: &types.StdSizes{
|
Sizes: &types.StdSizes{
|
||||||
int64(c.targetData.PointerSize()),
|
int64(wordSize),
|
||||||
int64(c.targetData.PrefTypeAlignment(c.i8ptrType)),
|
int64(c.targetData.PrefTypeAlignment(c.i8ptrType)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user