Skip to content

volatile_load & volatile_store fail on structs #11424

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

Closed
lexs opened this issue Jan 9, 2014 · 3 comments
Closed

volatile_load & volatile_store fail on structs #11424

lexs opened this issue Jan 9, 2014 · 3 comments

Comments

@lexs
Copy link

lexs commented Jan 9, 2014

volatile load/store as implemented in #11173 fails on structs.

test.rs

use std::intrinsics::{volatile_load, volatile_store};

struct Test {
    _buffer: [u8, ..256]
}

static mut test: Test = Test { _buffer: [0, ..256] };

pub fn main() {
    unsafe {
        let _a = volatile_load(&test);
        // volatile_store(&mut test, test);
    }
}

volatile_load:

Found return instr that returns non-void in Function of void return type!
  ret %struct.Test %3
 voidBroken module found, compilation aborted!

volatile_store:

rustc: …/src/llvm/lib/IR/Instructions.cpp:1085: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed.
@thestinger
Copy link
Contributor

This needs to be extended to handle non-immediate types in addition to immediate ones.

@huonw huonw changed the title volatile_load fails on structs volatile_load & volatile_store fail on structs Jun 16, 2014
@huonw
Copy link
Member

huonw commented Jun 16, 2014

Triage: updated code & expanded this issue to include volatile_store as well as volatile_load.

@steveklabnik
Copy link
Member

This example now compiles and runs successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants