Skip to content

Commit a5500b0

Browse files
committed
[AVR] Use LLVM bitcast instructions rather than pointercasts to avoid address space mismatch problems
This was suggested by @eddyb on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Better.20supporting.20Harvard.20architectures/near/202043069 Bitcasts do not suffer from the same address space casting issues.
1 parent 05630b0 commit a5500b0

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

src/librustc_codegen_llvm/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
744744
}
745745

746746
fn pointercast(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
747-
unsafe { llvm::LLVMBuildPointerCast(self.llbuilder, val, dest_ty, UNNAMED) }
747+
self.bitcast(val, dest_ty)
748748
}
749749

750750
/* Comparisons */

src/librustc_codegen_llvm/llvm/ffi.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,12 +1346,6 @@ extern "C" {
13461346
DestTy: &'a Type,
13471347
Name: *const c_char,
13481348
) -> &'a Value;
1349-
pub fn LLVMBuildPointerCast(
1350-
B: &Builder<'a>,
1351-
Val: &'a Value,
1352-
DestTy: &'a Type,
1353-
Name: *const c_char,
1354-
) -> &'a Value;
13551349
pub fn LLVMRustBuildIntCast(
13561350
B: &Builder<'a>,
13571351
Val: &'a Value,

0 commit comments

Comments
 (0)