Add explanations for ptr func call argument cast
This commit is contained in:
parent
527c049584
commit
dd4a546de0
@ -253,6 +253,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
|
|||||||
self.context.new_cast(self.location, actual_val, expected_ty)
|
self.context.new_cast(self.location, actual_val, expected_ty)
|
||||||
} else if on_stack_param_indices.contains(&index) {
|
} else if on_stack_param_indices.contains(&index) {
|
||||||
let ty = actual_val.get_type();
|
let ty = actual_val.get_type();
|
||||||
|
// It's possible that the value behind the pointer is actually not exactly
|
||||||
|
// the expected type, so to go around that, we add a cast before
|
||||||
|
// dereferencing the value.
|
||||||
if let Some(pointee_val) = ty.get_pointee()
|
if let Some(pointee_val) = ty.get_pointee()
|
||||||
&& pointee_val != expected_ty
|
&& pointee_val != expected_ty
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user