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

cargo +nightly-i686-pc-windows-msvc build crashes with very little info on what caused the error #73527

Open
super-continent opened this issue Jun 20, 2020 · 7 comments
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows-msvc Toolchain: MSVC, Operating system: Windows O-x86_32 Target: x86 processors, 32 bit (like i686-*) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@super-continent
Copy link

I'm attempting to build a small project I've been working on for 32-bit systems, it builds fine on 64-bit but after some quick porting rustc just crashes and outputs that the process didn't return successfully.

All the code I was attempting to compile can be found in this repo

I'm unsure what the actual cause of the bug is, as the output data with the -vv flag added only outputs the commands used to compile, no ICE or anything else, unsure what to make of it.

rustc --version --verbose:

rustc 1.46.0-nightly (e55d3f9c5 2020-06-18)
binary: rustc
commit-hash: e55d3f9c5213fe1a25366450127bdff67ad1eca2
commit-date: 2020-06-18
host: i686-pc-windows-msvc
release: 1.46.0-nightly
LLVM version: 10.0
@super-continent super-continent added the C-bug Category: This is a bug. label Jun 20, 2020
@tesuji
Copy link
Contributor

tesuji commented Jun 20, 2020

Try to run rustc in debugger like lldb or visual studio.

@jonas-schievink jonas-schievink added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows-msvc Toolchain: MSVC, Operating system: Windows labels Jun 20, 2020
@super-continent
Copy link
Author

I ran it in Visual Studio JIT debugger on crash and it gives me an unhandled exception for 0x10FD8305 (rustc_driver-c2b8445fecb811f3.dll) in rustc.exe: 0xC0000005: Access violation reading location 0x00007E47.

There seems to be a point where it accesses [EAX(0x7E3B) + 0x0C] and crashes, not sure how I would figure out where exactly in the program this is happening, are there debug symbols available?

@super-continent
Copy link
Author

Ok, I set RUSTC_LOG so it outputs info and heres the last 20 lines before a crash happens in the log. This probably narrows down the scope of where the issue might be, right?

[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::align_of_val::<alloc::sync::ArcInner<std::cell::UnsafeCell<std::option::Option<std::result::Result<(), std::boxed::Box<dyn std::any::Any + std::marker::Send>>>>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::align_of_val::<alloc::sync::ArcInner<std::sync::Mutex<helpers::Config>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::align_of_val::<alloc::sync::ArcInner<std::sync::Mutex<std::vec::Vec<std::vec::Vec<u8>>>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::align_of_val::<alloc::sync::ArcInner<std::thread::Inner>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::ManuallyDrop::<std::vec::Vec<u8>>::new)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::ManuallyDrop::<std::boxed::Box<detour::detours::generic::GenericDetour<extern "win64" fn(u32, u32, u32)>>>::new)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::min_align_of_val::<alloc::sync::ArcInner<std::sync::Mutex<std::vec::Vec<std::vec::Vec<u8>>>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::min_align_of_val::<alloc::sync::ArcInner<std::cell::UnsafeCell<std::option::Option<std::result::Result<(), std::boxed::Box<dyn std::any::Any + std::marker::Send>>>>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::min_align_of_val::<alloc::sync::ArcInner<std::thread::Inner>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::min_align_of_val::<alloc::sync::ArcInner<std::sync::Mutex<helpers::Config>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::drop::<std::sync::Weak<std::cell::UnsafeCell<std::option::Option<std::result::Result<(), std::boxed::Box<dyn std::any::Any + std::marker::Send>>>>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::drop::<std::boxed::Box<std::boxed::Box<dyn std::ops::Fn(u32, u32, u32)>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::drop::<std::sync::Weak<std::thread::Inner>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::drop::<std::sync::Weak<std::sync::Mutex<std::vec::Vec<std::vec::Vec<u8>>>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::drop::<std::sync::Weak<std::sync::Mutex<helpers::Config>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::forget::<std::vec::Vec<u8>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::mem::forget::<std::boxed::Box<detour::detours::generic::GenericDetour<extern "win64" fn(u32, u32, u32)>>>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::option::Option::<usize>::unwrap_or_else::<fn() -> usize {std::sys_common::thread::min_stack}>)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::option::Option::<&std::boxed::Box<dyn std::ops::Fn(u32, u32, u32)>>::ok_or::<detour::error::Error>)
error: could not compile `win32-dll-test`.

@super-continent
Copy link
Author

If I do cargo clean before building I get this output, seems to crash before that too.

[INFO  rustc_codegen_ssa::base] codegen_instance(<std::mem::ManuallyDrop<std::panic::AssertUnwindSafe<[closure@std::thread::Builder::spawn_unchecked::{{closure}}#0::{{closure}}#0 0:fn() {initialize}]>> as std::ops::DerefMut>::deref_mut)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::string::String::new)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::string::String::from_utf8)
[INFO  rustc_codegen_ssa::base] codegen_instance(<std::string::String as std::fmt::Display>::fmt)
[INFO  rustc_codegen_ssa::base] codegen_instance(<std::string::String as std::string::ToString>::to_string)
[INFO  rustc_codegen_ssa::base] codegen_instance(<std::string::String as std::ops::Deref>::deref)
[INFO  rustc_codegen_ssa::base] codegen_instance(<std::string::String as std::convert::AsRef<str>>::as_ref)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::sync::atomic::AtomicBool::load)
[INFO  rustc_codegen_ssa::base] codegen_instance(std::sync::atomic::AtomicBool::store)
error: could not compile `win32-dll-test`.

@super-continent
Copy link
Author

Is there any speculation possible on what the issue is? This is preventing me entirely from working on a project I want to start and I've been unsuccessful in figuring out the problem

@super-continent
Copy link
Author

Re-ran in debugger, seems that there is now a UD2 instruction in the execution? This is what my VS debug disassembly shows, throws exception as the instruction normally does. Odd thing is that before the crash was from an invalid memory access
image

@workingjubilee workingjubilee added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-codegen Area: Code generation labels Jul 12, 2023
@workingjubilee
Copy link
Contributor

Triaging this... very peculiar. Appears to deal with codegen. Only on 32-bit.

@Nilstrieb Nilstrieb added O-x86_32 Target: x86 processors, 32 bit (like i686-*) and removed O-x86-all labels Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-windows-msvc Toolchain: MSVC, Operating system: Windows O-x86_32 Target: x86 processors, 32 bit (like i686-*) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants