Closed
Description
One of the changes in libcore-mini
is the removal of the sync
module. Originally, it seemed #58 was the cause of needing to remove it, but now that that one is closed, it turns out it still can't be compiled.
The offending Rust code, stripped to its essentials, looks like this:
use core::intrinsics;
use core::cell::UnsafeCell;
use core::fmt;
pub struct AtomicI16 {
v: UnsafeCell<i16>,
}
impl fmt::Debug for AtomicI16 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple(stringify!(AtomicI16))
.field(&unsafe{ intrinsics::atomic_load(self.v.get()) })
.finish()
}
}
Further stripping down the resulting IR we get
target datalayout = "e-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8"
target triple = "avr-unknown-unknown"
%"atomic::AtomicI16" = type { %"core::cell::UnsafeCell<i16>", [0 x i8] }
%"core::cell::UnsafeCell<i16>" = type { i16, [0 x i8] }
; Function Attrs: uwtable
define void @foo(%"atomic::AtomicI16"*) {
start:
%_15 = alloca i16, align 1
%1 = getelementptr inbounds %"atomic::AtomicI16", %"atomic::AtomicI16"* %0, i16 0, i32 0, i32 0
%2 = load atomic i16, i16* %1 seq_cst, align 1
ret void
}
which results in the error message
LLVM ERROR: Cannot generate unaligned atomic load