Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

volatile_load + newtype = LLVM assertion #23550

Closed
japaric opened this issue Mar 20, 2015 · 1 comment · Fixed by #23570
Closed

volatile_load + newtype = LLVM assertion #23550

japaric opened this issue Mar 20, 2015 · 1 comment · Fixed by #23570
Assignees
Labels
A-codegen Area: Code generation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@japaric
Copy link
Member

japaric commented Mar 20, 2015

STR

#![crate_type = "lib"]

mod mmio {
    use std::intrinsics;

    pub struct RO<T>(T) where T: Copy;

    impl<T> RO<T> where T: Copy {
        pub fn get(&self) -> T {
            unsafe {
                intrinsics::volatile_load(&self.0)
            }
        }
    }
}

struct Gpio {
    idr: mmio::RO<Idr>,
}

#[derive(Copy)]
struct Idr(u32);

fn ice(gpio: &Gpio) -> Idr {
    gpio.idr.get()
}

Output

rustc: /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/IR/Instructions.cpp:1083: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.

I think this should work given that Idr is a newtype over a copyable/primitive type.

@dotdash dotdash self-assigned this Mar 20, 2015
@dotdash dotdash added A-codegen Area: Code generation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Mar 20, 2015
@dotdash
Copy link
Contributor

dotdash commented Mar 20, 2015

This is a regression from when we stopped to do FCA loads/stores.

dotdash added a commit to dotdash/rust that referenced this issue Mar 21, 2015
Boolean values and small aggregates have a different type in
args/allocas than in SSA values but the intrinsics for volatile and
atomic ops were missing the necessary casts to handle that.

Fixes rust-lang#23550
bors added a commit that referenced this issue Mar 21, 2015
Boolean values and small aggregates have a different type in args/allocas than
in SSA values but the intrinsics for volatile and atomic ops were
missing the necessary casts to handle that.

Fixes #23550
Manishearth added a commit to Manishearth/rust that referenced this issue Mar 21, 2015
 Boolean values and small aggregates have a different type in args/allocas than
in SSA values but the intrinsics for volatile and atomic ops were
missing the necessary casts to handle that.

Fixes rust-lang#23550
Manishearth added a commit to Manishearth/rust that referenced this issue Mar 22, 2015
 Boolean values and small aggregates have a different type in args/allocas than
in SSA values but the intrinsics for volatile and atomic ops were
missing the necessary casts to handle that.

Fixes rust-lang#23550
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants