Skip to content

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

Not planned
@saethlin

Description

@saethlin
Member

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

Activity

oli-obk

oli-obk commented on May 1, 2022

@oli-obk
Contributor

Possibly related to nonzst allocators ICEs everywhere?

May get fixed by #95576

beepster4096

beepster4096 commented on May 1, 2022

@beepster4096
Contributor

@rustbot claim

RalfJung

RalfJung commented on May 4, 2022

@RalfJung
Member

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

RalfJung

RalfJung commented on Jun 25, 2022

@RalfJung
Member

Closing as duplicate of #95453.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-miriArea: The miri toolC-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @RalfJung@oli-obk@saethlin@beepster4096

      Issue actions

        ICE in Miri: "primitive read failed for type", due to reading a Boxed slice with an allocator? · Issue #96608 · rust-lang/rust