From ddbf80b5426107440dedc54f9860ab5662cabf57 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 3 Jun 2012 20:54:08 -0300 Subject: [PATCH] b2/: handle attempts to break/continue (in substitutions) without a block --- b2/subst.c | 2 ++ b2/test/subcont | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/b2/subst.c b/b2/subst.c index ce64677..1bba496 100644 --- a/b2/subst.c +++ b/b2/subst.c @@ -395,6 +395,8 @@ static void recurse_fin(struct subst *sub, const struct parent *parent) case st_break: /* fall through */ case st_continue: + if (!parent) + yyerror("jump without block"); sub->u.jump = resolve_jump(sub->u.tmp, parent); break; default: diff --git a/b2/test/subcont b/b2/test/subcont index f22141f..a52c718 100755 --- a/b2/test/subcont +++ b/b2/test/subcont @@ -126,4 +126,15 @@ expect <