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; CodeMark Mark;
GetCodePos (&Mark); GetCodePos (&Mark);
hie10 (Expr); hie10 (Expr);
/* If the expression is a literal string, release it, so it if (ED_IsBitField (Expr)) {
** won't be output as data if not used elsewhere. Error ("Cannot apply 'sizeof' to bit-field");
*/ Size = 0;
if (ED_IsLocLiteral (Expr)) { } else {
ReleaseLiteral (Expr->LVal); /* 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 */ /* Remove any generated code */
RemoveCode (&Mark); RemoveCode (&Mark);
} }