From 8e12e57781380d76e5a64e464b28b402aa875b22 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 23 Mar 2016 12:26:16 -0400 Subject: [PATCH] fix #15600, lowering bug in symbolic goto --- src/julia-syntax.scm | 1 + test/goto.jl | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 90d5d7e49ab88..3ef8e8681400c 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -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)))) diff --git a/test/goto.jl b/test/goto.jl index d8ef11b2a4c93..f5181af6f61e2 100644 --- a/test/goto.jl +++ b/test/goto.jl @@ -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