Skip to content

Commit

Permalink
fix #15600, lowering bug in symbolic goto
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Mar 23, 2016
1 parent c29bff1 commit 8e12e57
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3052,6 +3052,7 @@ f(x) = yt(x)
(m (or m (let ((l (make-label)))
(put! label-map (cadr e) l)
l))))
(emit `(null)) ;; save space for `leave` that might be needed
(emit `(goto ,m))
(set! handler-goto-fixups
(cons (list code handler-level (cadr e)) handler-goto-fixups))))
Expand Down
17 changes: 17 additions & 0 deletions test/goto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,20 @@ end

GotoMacroTest.@goto_test8_macro

# issue #15600
function t0_15600(flag)
flag && @goto return2
return 1
@label return2
return 2
end
@test t0_15600(true) == 2
@test t0_15600(false) == 1
function t1_15600(flag)
flag || @goto return2
return 1
@label return2
return 2
end
@test t1_15600(true) == 1
@test t1_15600(false) == 2

0 comments on commit 8e12e57

Please sign in to comment.