Skip to content

Commit

Permalink
Merge pull request #5723 from tautschnig/single-bit
Browse files Browse the repository at this point in the history
C front-end: hide our use of single-bit bool within sizeof
  • Loading branch information
tautschnig authored Mar 15, 2021
2 parents 276b8d7 + 5f86851 commit f649c47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion regression/ansi-c/sizeof4/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KNOWNBUG
CORE
main.c

^EXIT=0$
Expand Down
9 changes: 8 additions & 1 deletion src/ansi-c/c_typecheck_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,14 @@ void c_typecheck_baset::typecheck_expr_sizeof(exprt &expr)
}
else
{
type.swap(to_unary_expr(expr).op().type());
const exprt &op = to_unary_expr(as_const(expr)).op();
// This is one of the few places where it's detectable
// that we are using "bool" for boolean operators instead
// of "int". We convert for this reason.
if(op.type().id() == ID_bool)
type = signed_int_type();
else
type = op.type();
}

exprt new_expr;
Expand Down

0 comments on commit f649c47

Please sign in to comment.