Description
It seems that there is a some sort of wrong optimization of Some(Rc<RefCell<...>>) by using thread_local!. Code like this one https://github.com/michaelvoronov/rust_poc_1 is failed on
rust/src/libstd/thread/local.rs
Line 277 in c84e797
error: process didn't exit successfully: "target\debug\rust_poc_1" (exit code: 0xc000001d, STATUS_ILLEGAL_INSTRUCTION)
I dig a little bit around and find out that decompiled code of init
for this code looks like that: https://gist.github.com/michaelvoronov/b4aa66d36fe44c99df05a9249a6c708c. But if we delete Rc
from ArrayDeque<[Rc<RefCell<SomeStruct>>; 1024], Wrapping>
, we obtain decompiled listing like this one: https://gist.github.com/michaelvoronov/a5f2ca75c1c7cdc7547298d12e5c1edf (it isn't failed).
It seems that the key difference is *(_QWORD *)some_value = 1i64;
that represents Some
of Option
enum.
P.S. Tested on 1.34.0-nightly
toolchain.