Skip to content

STATUS_ACCESS_VIOLATION in unstable thread_local feature on windows-gnu #100917

Open
@uselessgoddess

Description

I tried this code:

#![feature(thread_local)]

use std::cell::RefCell;
use std::mem::MaybeUninit;

#[thread_local]
static PLACE: RefCell<usize> = RefCell::new(0);

fn touch(x: usize) {
    *PLACE.borrow_mut() = x;
}

pub fn main() {
    touch(12);
}

But it breaks down inside RefCell:
error: process didn't exit successfully: 'target\debug\sandbox.exe' (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

Debugger comes to here:
image

rustc 1.65.0-nightly (878aef79d 2022-08-20)
binary: rustc
commit-hash: 878aef79dcdf59d19bb8482202dc55e58ceb62ff
commit-date: 2022-08-20
host: x86_64-pc-windows-gnu
release: 1.65.0-nightly
LLVM version: 15.0.0

Activity

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

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-thread_local`#![feature(thread_local)]`O-windows-gnuToolchain: GNU, Operating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions