mindcode icon indicating copy to clipboard operation
mindcode copied to clipboard

Wrong expression handling in loops

Open cardillan opened this issue 10 months ago • 0 comments

The Data Flow Optimizer mishandles loop expression. This code

x = 0
while true
    print(x + 1)
    x = rand(10)
    print(x + 1)
end

compiles into

print __tmp2
op rand x 10 0
op add __tmp2 x 1
print __tmp2
jump 0 always 0 0

and produces (correctly) a warning about the __tmp2 variable being uninitialized.

cardillan avatar Apr 16 '24 22:04 cardillan