From b27758b7de0d4bb20e29a1012824b25af9e13a26 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 29 Sep 2016 22:14:11 +0200 Subject: [PATCH] Error check fragment rules which don't emit anything. --- util/mcgg/iburg.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/util/mcgg/iburg.c b/util/mcgg/iburg.c index 0e8cad407..1fc0a7c22 100644 --- a/util/mcgg/iburg.c +++ b/util/mcgg/iburg.c @@ -1014,6 +1014,15 @@ static void emitinsndata(Rule rules) print("}\n\n"); } + else + { + /* This instruction has no code; make sure it's not a fragment. */ + if (r->lhs->is_fragment) + { + yylineno = r->lineno; + yyerror("rule is a fragment, but doesn't emit anything"); + } + } r = r->link; }