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

Enable hex printer in cargo-miri-test #416

Closed
RalfJung opened this issue Jul 26, 2018 · 3 comments
Closed

Enable hex printer in cargo-miri-test #416

RalfJung opened this issue Jul 26, 2018 · 3 comments

Comments

@RalfJung
Copy link
Member

Once rust-lang/rust#52744 lands

We probably should also add memrchr to the main test suite, then.

@RalfJung
Copy link
Member Author

It occurred to me that my patch would not be sufficient, and indeed...

error[E0080]: constant evaluation error: tried to access memory with alignment 1, but alignment 8 is required
   --> /home/r/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/slice/memchr.rs:119:21
    |
119 |             let u = *(ptr.offset(offset as isize - 2 * usize_bytes as isize) as *const usize);
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tried to access memory with alignment 1, but alignment 8 is required
    |
note: inside call to `core::slice::memchr::memrchr`
   --> tests/run-pass-fullmir/memchr.rs:69:39
    |
69  |         assert_eq!(Some(pos - start), memrchr(needle, &data[start..]));
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to `each_alignment_reversed`
   --> tests/run-pass-fullmir/memchr.rs:89:5
    |
89  |     each_alignment_reversed();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

miri puts the entire slice into the first argument, leading memrchr to think that most of it is actually aligned.

I'll have to tweak the implementation some more.

@RalfJung
Copy link
Member Author

Opened rust-lang/rust#52854

@RalfJung
Copy link
Member Author

Fixed by #423

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

1 participant