diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-05-22 15:19:15 +0200 |
|---|---|---|
| committer | Antoni Boucher <bouanto@zoho.com> | 2024-07-02 12:24:11 -0400 |
| commit | dd4a546de0af391759a901ac070e6ca66a6c7af1 (patch) | |
| tree | e295b350fbdb1d18d817f954cebe9e6fd4c981d0 | |
| parent | 527c04958469c3d8701d3ab0dedb16fa396a7900 (diff) | |
| download | rust-dd4a546de0af391759a901ac070e6ca66a6c7af1.tar.gz rust-dd4a546de0af391759a901ac070e6ca66a6c7af1.zip | |
Add explanations for ptr func call argument cast
| -rw-r--r-- | src/builder.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/builder.rs b/src/builder.rs index c5819ff93d7..0d5ef42833d 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -253,6 +253,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { self.context.new_cast(self.location, actual_val, expected_ty) } else if on_stack_param_indices.contains(&index) { 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() && pointee_val != expected_ty { |
