File tree 2 files changed +16
-2
lines changed
regression/ansi-c/sizeof4 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 1
- KNOWNBUG
1
+ CORE
2
2
main.c
3
3
4
4
^EXIT=0$
Original file line number Diff line number Diff line change @@ -950,7 +950,21 @@ void c_typecheck_baset::typecheck_expr_sizeof(exprt &expr)
950
950
}
951
951
else
952
952
{
953
- type.swap (to_unary_expr (expr).op ().type ());
953
+ const exprt &op = to_unary_expr (as_const (expr)).op ();
954
+ // This is one of the few places where it's detectable
955
+ // that we are using "bool" for boolean operators instead
956
+ // of "int". We convert for this reason.
957
+ if (
958
+ op.type ().id () == ID_bool &&
959
+ (op.id () == ID_not || op.id () == ID_and || op.id () == ID_or ||
960
+ op.id () == ID_equal || op.id () == ID_notequal || op.id () == ID_lt ||
961
+ op.id () == ID_le || op.id () == ID_gt || op.id () == ID_ge ||
962
+ op.id () == ID_if))
963
+ {
964
+ type = signed_int_type ();
965
+ }
966
+ else
967
+ type = op.type ();
954
968
}
955
969
956
970
exprt new_expr;
You can’t perform that action at this time.
0 commit comments