From 60d8559372c3cfd89c41c3e392086c486794571d Mon Sep 17 00:00:00 2001 From: Lauri Kasanen Date: Sun, 14 Apr 2019 19:47:42 +0300 Subject: [PATCH] Return after errors, move left bracket consumption down --- src/cc65/goto.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cc65/goto.c b/src/cc65/goto.c index 08a7033c3..fde9df945 100644 --- a/src/cc65/goto.c +++ b/src/cc65/goto.c @@ -87,15 +87,20 @@ void GotoStatement (void) if (CurTok.Tok == TOK_IDENT && (arr = FindSym (CurTok.Ident))) { NextToken (); - ConsumeLBrack (); /* Find array size */ if (!IsTypeArray (arr->Type) || SizeOf (arr->Type) == 0 || - SizeOf (GetElementType(arr->Type)) != 2) + SizeOf (GetElementType(arr->Type)) != 2) { Error ("Expected array"); - if (GetElementCount (arr->Type) > 127) + return; + } + if (GetElementCount (arr->Type) > 127) { Error ("Only arrays with <= 127 labels are supported, got %lu", GetElementCount (arr->Type)); + return; + } + + ConsumeLBrack (); if (CurTok.Tok == TOK_ICONST) { val = CurTok.IVal; -- 2.39.2