summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/vmgen.nim14
-rw-r--r--tests/vm/tstaticprintseq.nim6
2 files changed, 11 insertions, 9 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index 3c0f8dbc9..85416f7bc 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -328,6 +328,7 @@ proc canonValue*(n: PNode): PNode =
 
 proc rawGenLiteral(c: PCtx; n: PNode): int =
   result = c.constants.len
+  assert(n.kind != nkCall)
   c.constants.add n.canonValue
   internalAssert result < 0x7fff
 
@@ -1285,16 +1286,13 @@ proc genVarSection(c: PCtx; n: PNode) =
         if s.position == 0:
           if sfImportc in s.flags: c.importcSym(a.info, s)
           else:
-            let sa = if s.ast.isNil: getNullValue(s.typ, a.info) 
-                     else: canonValue(s.ast)
+            let sa = getNullValue(s.typ, a.info)
+            #if s.ast.isNil: getNullValue(s.typ, a.info)
+            #else: canonValue(s.ast)
+            assert sa.kind != nkCall
             c.globals.add(sa)
             s.position = c.globals.len
-        if a.sons[2].kind == nkEmpty:
-          when false:
-            withTemp(tmp, s.typ):
-              c.gABx(a, opcLdNull, tmp, c.genType(s.typ))
-              c.gABx(a, whichAsgnOpc(a.sons[0], opcWrGlobal), tmp, s.position)
-        else:
+        if a.sons[2].kind != nkEmpty:
           let tmp = c.genx(a.sons[0], {gfAddrOf})
           let val = c.genx(a.sons[2])
           c.gABC(a, opcWrDeref, tmp, val)
diff --git a/tests/vm/tstaticprintseq.nim b/tests/vm/tstaticprintseq.nim
index 3dfd0048d..b9658e93d 100644
--- a/tests/vm/tstaticprintseq.nim
+++ b/tests/vm/tstaticprintseq.nim
@@ -17,7 +17,8 @@ bb
 22
 aa
 bb
-24'''
+24
+2147483647 2147483647'''
 """
 
 const s = @[1,2,3]
@@ -76,3 +77,6 @@ const y = fac()
 static:
   echo y
 
+static:
+  var foo = int32.high
+  echo foo, " ", int32.high
rtik.com> 2019-07-10 10:55:30 -0700 zero out new rows returned by get-or-insert' href='/akkartik/mu/commit/subx/076zero-out.subx?h=hlt&id=c6ec8fa3f77ba24e92ce8fda32b6919f0f67e496'>c6ec8fa3 ^
33352536 ^
c6ec8fa3 ^
33352536 ^
c6ec8fa3 ^


33352536 ^



c6ec8fa3 ^
33352536 ^

c6ec8fa3 ^



33352536 ^


c6ec8fa3 ^
33352536 ^

c6ec8fa3 ^

33352536 ^
c6ec8fa3 ^


33352536 ^
c6ec8fa3 ^
33352536 ^
c6ec8fa3 ^


33352536 ^
c6ec8fa3 ^


33352536 ^
c6ec8fa3 ^
33352536 ^

c6ec8fa3 ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84