1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Disabled applying 'sizeof' to bit-fields.

This commit is contained in:
acqn 2020-07-19 21:23:20 +08:00 committed by Oliver Schmidt
parent 62a6e37487
commit b67b8ddd38

View File

@ -1898,14 +1898,19 @@ void hie10 (ExprDesc* Expr)
CodeMark Mark;
GetCodePos (&Mark);
hie10 (Expr);
/* If the expression is a literal string, release it, so it
** won't be output as data if not used elsewhere.
*/
if (ED_IsLocLiteral (Expr)) {
ReleaseLiteral (Expr->LVal);
if (ED_IsBitField (Expr)) {
Error ("Cannot apply 'sizeof' to bit-field");
Size = 0;
} else {
/* If the expression is a literal string, release it, so it
** won't be output as data if not used elsewhere.
*/
if (ED_IsLocLiteral (Expr)) {
ReleaseLiteral (Expr->LVal);
}
/* Calculate the size */
Size = CheckedSizeOf (Expr->Type);
}
/* Calculate the size */
Size = CheckedSizeOf (Expr->Type);
/* Remove any generated code */
RemoveCode (&Mark);
}