compiler: fix unsafe.Sizeof and friends for AVR

This fixes runtime.printptr().
This commit is contained in:
Ayke van Laethem
2018-09-16 20:42:10 +02:00
parent e04f0868ed
commit 94358959f5
2 changed files with 150 additions and 7 deletions
+4 -7
View File
@@ -139,15 +139,12 @@ 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(wordSize),
int64(c.targetData.PrefTypeAlignment(c.i8ptrType)),
Sizes: &StdSizes{
IntSize: int64(c.targetData.TypeAllocSize(c.intType)),
PtrSize: int64(c.targetData.PointerSize()),
MaxAlign: int64(c.targetData.PrefTypeAlignment(c.i8ptrType)),
},
},
Build: &build.Context{