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

ICE in Miri: "primitive read failed for type", due to reading a Boxed slice with an allocator? #96608

Closed
saethlin opened this issue May 1, 2022 · 4 comments
Assignees
Labels
A-miri Area: The miri tool C-bug Category: This is a bug.

Comments

@saethlin
Copy link
Member

saethlin commented May 1, 2022

Unclear if this is a Miri issue or a rustc issue, but it looks to me like the issue is squarely in the CTFE code so I'm reporting it here.

I'm trying to improve on the experimental PR to use Box to implement Vec: #96607 and I'm using miri-test-libstd to see how things are going. I've gotten all the way to running tests, but I immediately ran into an ICE:

     Running unittests ../liballoc/src/lib.rs (/home/ben/miri-test-libstd/target/miri/x86_64-unknown-linux-gnu/debug/deps/alloc_miri_test-1f894794e44196e9)

running 308 tests
test alloc::tests::alloc_owned_small ... ignored
test alloc::tests::allocate_zeroed ... ok
test box_storage::tests::allocator_param ... error: internal compiler error: /rustc/18b53cefdf7456bf68937b08e377b7e622a115c2/compiler/rustc_const_eval/src/interpret/operand.rs:328:13: primitive read failed for type: std::boxed::Box<[core::mem::MaybeUninit<u8>], box_storage::tests::allocator_param::BoundedAlloc>
    --> /home/ben/rust/library/alloc/src/boxed.rs:1007:9
     |
1007 |         Box(unsafe { Unique::new_unchecked(raw) }, alloc)
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/18b53cefdf7456bf68937b08e377b7e622a115c2/compiler/rustc_errors/src/lib.rs:1253:9
...

This can be reproduced by running miri-test-libstd on #96607. (the PR is very hacked-up right now)

There have been issues along this code path before, but none of them seem relevant to this particular situation?

cc @oli-obk @RalfJung

@saethlin saethlin added the C-bug Category: This is a bug. label May 1, 2022
@oli-obk
Copy link
Contributor

oli-obk commented May 1, 2022

Possibly related to nonzst allocators ICEs everywhere?

May get fixed by #95576

@beepster4096
Copy link
Contributor

@rustbot claim

@RalfJung RalfJung added the A-miri Area: The miri tool label May 4, 2022
@RalfJung
Copy link
Member

RalfJung commented May 4, 2022

Yeah, can you find out what the allocator type is there?
Sounds like a duplicate of #95453.

@RalfJung
Copy link
Member

Closing as duplicate of #95453.

@RalfJung RalfJung closed this as not planned Won't fix, can't repro, duplicate, stale Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-miri Area: The miri tool C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants