From d0981bca9268f175a22f10b537c0099fb76921fd Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 19 Jul 2023 20:22:32 -0400 Subject: [PATCH] libcdecl: Fix crash when bootstrapped w/ old Bison. We are comparing the packed token value to check whether this is an identifier or a keyword against the true value. This happens to work on new Bison (when using api.token.raw) as these values are the same, but on old Bison the result is never true. Thus, the scanner fails to assign the "strval" for identifier tokens and the result fails very badly. Easy enough to fix. --- src/scan.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scan.l b/src/scan.l index 90f5ad9..767ba22 100644 --- a/src/scan.l +++ b/src/scan.l @@ -173,7 +173,7 @@ INTEGER 0x[[:xdigit:]]+|0[0-7]+|[[:digit:]]+ int tok; yylval->spectype = UNPACK_SPEC(x & 0xff); - if ((tok = (x >> 8)) == T_IDENT) { + if ((tok = (x >> 8)) == PACK_TOKEN(T_IDENT)) { /* * Our IDENT pattern includes hyphens so we can match * "variable-length" as a keyword. In all other cases a -- 2.43.2