|
@@ -2380,9 +2380,15 @@ bool check_cast_internal(CheckerContext *c, Operand *x, Type *type) {
|
|
if (core_type(bt)->kind == Type_Basic) {
|
|
if (core_type(bt)->kind == Type_Basic) {
|
|
if (check_representable_as_constant(c, x->value, bt, &x->value)) {
|
|
if (check_representable_as_constant(c, x->value, bt, &x->value)) {
|
|
return true;
|
|
return true;
|
|
- } else if (is_type_pointer(type) && check_is_castable_to(c, x, type)) {
|
|
|
|
- return true;
|
|
|
|
|
|
+ } else if (check_is_castable_to(c, x, type)) {
|
|
|
|
+ if (is_type_pointer(type)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } else if (check_is_castable_to(c, x, type)) {
|
|
|
|
+ x->value = {};
|
|
|
|
+ x->mode = Addressing_Value;
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
} else if (check_is_castable_to(c, x, type)) {
|
|
} else if (check_is_castable_to(c, x, type)) {
|
|
if (x->mode != Addressing_Constant) {
|
|
if (x->mode != Addressing_Constant) {
|
|
@@ -2392,6 +2398,9 @@ bool check_cast_internal(CheckerContext *c, Operand *x, Type *type) {
|
|
} else if (is_type_union(type)) {
|
|
} else if (is_type_union(type)) {
|
|
x->mode = Addressing_Value;
|
|
x->mode = Addressing_Value;
|
|
}
|
|
}
|
|
|
|
+ if (x->mode == Addressing_Value) {
|
|
|
|
+ x->value = {};
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|