shithub: rgbds

Download patch

ref: 6662c86d5e886e08aae178a1f9748a7339e0658e
parent: 2f466c2939cf4a0909ae9c9a4aa34a7bcf4a6eae
author: ISSOtm <eldredhabert0@gmail.com>
date: Sat Mar 14 12:17:30 EDT 2020

Define 3-bit value when invalid

--- a/src/asm/asmy.y
+++ b/src/asm/asmy.y
@@ -1055,10 +1055,13 @@
 
 const_3bit	: const {
 			int32_t value = $1;
-			if ((value < 0) || (value > 7))
+
+			if ((value < 0) || (value > 7)) {
 				yyerror("Immediate value must be 3-bit");
-			else
+				$$ = 0;
+			} else {
 				$$ = value & 0x7;
+			}
 		}
 ;