Skip to content

Commit

Permalink
Pointer fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
markkurossi committed Aug 4, 2024
1 parent 09d05f1 commit 6a8b035
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler/ssa/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ func (v Value) Indirect(block *Block, gen *Generator) Value {
panic("Value.Indirect: could not find pointer target")
}
cv := b.Value(block, gen)
elType := *v.Type.ElementType

if v.PtrInfo.ContainerType.Type != types.TStruct {
if v.PtrInfo.ContainerType.Equal(elType) {
return cv
}

// Get struct field value.
elType := *v.Type.ElementType
// The pointed value is part of container value. Let's return that
// slice.
ev := gen.AnonVal(elType)
fromConst := gen.Constant(int64(v.PtrInfo.Offset), types.Undefined)
toConst := gen.Constant(int64(v.PtrInfo.Offset+elType.Bits),
Expand Down

0 comments on commit 6a8b035

Please sign in to comment.