From 44c6681a66df5e84e2cd8e56fbd8f968be2fafd6 Mon Sep 17 00:00:00 2001 From: AWoloszyn Date: Thu, 31 Jan 2019 13:43:35 -0500 Subject: [PATCH] Fix effect of pointer[n] for n > 0. Pointer[n] was incorrectly getting translated to slice(n, n+1)[n], instead of slice(n, n+1)[0]. --- gapil/resolver/expression.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gapil/resolver/expression.go b/gapil/resolver/expression.go index 48b91fc997..d866f81584 100644 --- a/gapil/resolver/expression.go +++ b/gapil/resolver/expression.go @@ -346,7 +346,7 @@ func index(rv *resolver, in *ast.Index) semantic.Expression { // pointer[n] r := &semantic.BinaryOp{LHS: n, Operator: ast.OpSlice, RHS: n + 1} slice := &semantic.PointerRange{AST: in, Pointer: object, Type: at.Slice, Range: r} - out := &semantic.SliceIndex{AST: in, Slice: slice, Type: at.Slice, Index: n} + out := &semantic.SliceIndex{AST: in, Slice: slice, Type: at.Slice, Index: semantic.Uint64Value(0)} rv.mappings.Add(in, out) return out }