Repository: goplus/gop
Pull request #544 (2020-08-12 07:26:20)

fix build for GOARCH=386

codecov-commenter: # [Codecov](https://codecov.io/gh/goplus/gop/pull/544?src=pr&el=h1) Report
> Merging [#544](https://codecov.io/gh/goplus/gop/pull/544?src=pr&el=desc) into [master](https://codecov.io/gh/goplus/gop/commit/4ee8417fa1cb23a057aca51b104c90f469b91365&el=desc) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/goplus/gop/pull/544/graphs/tree.svg?width=650&height=150&src=pr&token=4qln9Wk3Pn)](https://codecov.io/gh/goplus/gop/pull/544?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #544   +/-   ##
=======================================
  Coverage   89.88%   89.88%           
=======================================
  Files          40       40           
  Lines       10190    10190           
=======================================
  Hits         9159     9159           
  Misses        752      752           
  Partials      279      279           
```


| [Impacted Files](https://codecov.io/gh/goplus/gop/pull/544?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [exec/bytecode/gopkg.go](https://codecov.io/gh/goplus/gop/pull/544/diff?src=pr&el=tree#diff-ZXhlYy9ieXRlY29kZS9nb3BrZy5nbw==) | `88.37% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/goplus/gop/pull/544?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/goplus/gop/pull/544?src=pr&el=footer). Last update [4ee8417...def89c8](https://codecov.io/gh/goplus/gop/pull/544?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/cl/ctx_check.go b/cl/ctx_check.go
index 0b8b9976..0211ede5 100644
--- a/cl/ctx_check.go
+++ b/cl/ctx_check.go
@@ -102,6 +102,8 @@ func isNoExecCtxExpr(ctx *blockCtx, expr ast.Expr) bool {
 		return isNoExecCtxExpr(ctx, v.X)
 	case *ast.SelectorExpr:
 		return isNoExecCtxExpr(ctx, v.X)
+	case *ast.ParenExpr:
+		return isNoExecCtxExpr(ctx, v.X)
 	case *ast.ErrWrapExpr:
 		return isNoExecCtx2nd(ctx, v.X, v.Default)
 	case *ast.IndexExpr:
diff --git a/exec/bytecode/gopkg.go b/exec/bytecode/gopkg.go
index 539d663b..5dff8e11 100644
--- a/exec/bytecode/gopkg.go
+++ b/exec/bytecode/gopkg.go
@@ -436,7 +436,7 @@ func (p *Builder) LoadField(v interface{}, index []int) *Builder {
 	case reflect.Type:
 	}
 	p.Push(index)
-	i := (opLoadField << bitsOpShift)
+	i := uint32(opLoadField << bitsOpShift)
 	p.code.data = append(p.code.data, uint32(i))
 	return p
 }
@@ -451,7 +451,7 @@ func (p *Builder) AddrField(v interface{}, index []int) *Builder {
 	case reflect.Type:
 	}
 	p.Push(index)
-	i := (opAddrField << bitsOpShift)
+	i := uint32(opAddrField << bitsOpShift)
 	p.code.data = append(p.code.data, uint32(i))
 	return p
 }
@@ -466,7 +466,7 @@ func (p *Builder) StoreField(v interface{}, index []int) *Builder {
 	case reflect.Type:
 	}
 	p.Push(index)
-	i := (opStoreField << bitsOpShift)
+	i := uint32(opStoreField << bitsOpShift)
 	p.code.data = append(p.code.data, uint32(i))
 	return p
 }


Test patch:
diff --git a/exec/bytecode/const_test.go b/exec/bytecode/const_test.go
index 24794f26..d20e7f05 100644
--- a/exec/bytecode/const_test.go
+++ b/exec/bytecode/const_test.go
@@ -24,12 +24,12 @@ import (
 
 func TestConst1(t *testing.T) {
 	code := newBuilder().
-		Push(1 << 32).
+		Push(int64(1 << 32)).
 		Resolve()
 
 	ctx := NewContext(code)
 	ctx.Exec(0, code.Len())
-	if v := checkPop(ctx); v != 1<<32 {
+	if v := checkPop(ctx); v != int64(1<<32) {
 		t.Fatal("1<<32 != 1<<32, ret =", v)
 	}
 }
diff --git a/exec/golang/testdata/11.for-loop/for.gop b/exec/golang/testdata/11.for-loop/for.gop
index 06a18bee..8e33693f 100644
--- a/exec/golang/testdata/11.for-loop/for.gop
+++ b/exec/golang/testdata/11.for-loop/for.gop
@@ -101,3 +101,8 @@ for i := 0; i < len(arr); i++ {
 	}
 }
 println("sum==36", sum == 36, sum)
+
+// issues #545
+for k <- [1, 2] {
+	println(k, (k+1)%2)
+}