Check if integer constants only contain radix prefix

This commit is contained in:
dbrotz
2018-12-02 16:16:41 -08:00
parent 5cb6c4af4b
commit f5d3087e9b
2 changed files with 9 additions and 1 deletions

View File

@@ -100,7 +100,13 @@ static int32_t ascii2bin(char *s)
break;
}
if (radix == 4) {
if (*s == '\0') {
/*
* There are no digits after the radix prefix
* (or the string is empty, which shouldn't happen).
*/
yyerror("Invalid integer constant");
} else if (radix == 4) {
int32_t c;
while (*s != '\0') {

View File

@@ -1,2 +1,4 @@
ERROR: divzero-section-bank.asm(1):
Invalid integer constant
ERROR: divzero-section-bank.asm(1):
Division by zero