Red: Get-word! value at end of block or paren corrupts compiler's stack

Created on 20 Sep 2016  路  3Comments  路  Source: red/red

This is same error as #1865 (that is fixed for interpreter), but for compiler (where it is still a bug):

Source code:

Red []

print "Expected: ok"
probe (a: 'ok 1 :a)

print "Expected: ok"
probe (a: 'ok 1 + 1 :a)

print "Expected: ok"
probe (a: 'ok 1 + 1 probe :a)

Compiled output:

E:\Code\red (master)
位 test
Expected: ok
ok
Expected: ok
2
Expected: ok
ok
2
status.built status.tested test.written type.bug

All 3 comments

The fix is incomplete. Compiling this:

Red []

print "case 1"
probe equal? 'ok (a: 'ok 1 + 1 :a)

print "case 2"
probe equal? 'ok probe (a: 'ok 1 + 1 :a)

Gives out:

case 1
false
case 2
ok
true

while the only difference is probe

Found more. Affects the interpreter only. Compiled output is 0 0 0 0

>> n: func [/a][100]
== func [/a][100]
>> n - (0 n/a)
== 0
>> n - (x: 0 n)
== 0
>> n - (x: 0 n/a)
== 100
>> n - (x: 123 n/a)
== -23
>> n - (x: 0 123 n/a)
== 0
>> n - (x: 0 n/a n/a)
== 0

Fun stuff. :^)

Was this page helpful?
0 / 5 - 0 ratings