Make sure that parsed subexpressions are fully defined

We were not initializing some expressions, and they were using
the values of the previous expressions instead. This just so
happened to not crash the tests, and to sometimes even give valid
results (although `BANK()` of a non-label symbol being $4B4E4142,
the ASCII balue of "BANK", was something we missed).
This commit is contained in:
Rangi42
2024-03-06 15:53:01 -05:00
parent f419f206e5
commit 75105016f7
3 changed files with 11 additions and 7 deletions

View File

@@ -1676,12 +1676,13 @@ sectattrs:
$$.bank = -1;
}
| sectattrs T_COMMA T_OP_ALIGN T_LBRACK align_spec T_RBRACK {
$$ = $1;
$$.alignment = $5.alignment;
$$.alignOfs = $5.alignOfs;
}
| sectattrs T_COMMA T_OP_BANK T_LBRACK uconst T_RBRACK {
// We cannot check the validity of this now
$$.bank = $5;
$$ = $1;
$$.bank = $5; // We cannot check the validity of this yet
}
;