Merge pull request #2729 from kugelfuhr/kugelfuhr/fix-2208

When studying a symbol expression use its address size if its smaller than that of the symbol
This commit is contained in:
Bob Andrews
2025-06-23 14:22:22 +02:00
committed by GitHub

View File

@@ -610,12 +610,13 @@ static void StudySymbol (ExprNode* Expr, ExprDesc* D)
DumpExpr (Expr, SymResolve);
}
/* If the symbol has an explicit address size, use it. This may
** lead to range errors later (maybe even in the linker stage), if
** the user lied about the address size, but for now we trust him.
/* If the symbol has an explicit address size that is smaller than
** the one found, use it. This may lead to range errors later
** (maybe even in the linker stage) if the user lied about the
** address size, but for now we trust him.
*/
AddrSize = GetSymAddrSize (Sym);
if (AddrSize != ADDR_SIZE_DEFAULT) {
if (AddrSize != ADDR_SIZE_DEFAULT && AddrSize < D->AddrSize) {
D->AddrSize = AddrSize;
}
}