Change:
I'm trying to build ripgrep with its SIMD optimizations on, and on Archlinux this means that ripgrep is compiled as follows: However, the build fails with the following error: I tried checking out the appropriate commit in the winapi-rs repo where kernel32-sys 0.2.2 is available, and was able to reproduce this problem directly with the kernel32-sys crate: If I omit the RUSTFLAGS variable, everything compiles fine: Compiler version: Also, I'm running a Skylake i7 CPU, here is my /proc/cpuinfo, if it is relevant:
I cannot reproduce. Does (when run from lib/kernel32) still reproduce? If so, could you run it under a debugger and retrieve a backtrace?
well, the command you provided does work correctly, but as far as I can see, it happens not in the itself but in the build script, and not when compiling that script but when it is run. So, it seems that rustc generates invalid assembly for the build script.
Here is the output of :
In case it is helpful, here is the backtrace for the build script:
Could you also while on the breakpoint in the build script? Thanks. (Sidenote: seems like has resurfaced)
Sure. here it is:
BTW, I had encountered it when I tried to install ripgrep somewhere around a month or a month and a half ago, there was exactly the same problem but I didn't report it then because I thought it was one of those occasional nightly instabilities.
is indeed an AVX-512 instruction which isn’t supported by your CPU. As a workaround I suggest using and if that doesn’t work . Alternatively you could try along with .
did help, thank you!
I have a similar problem where Rust is generating vmov instructions and these workarounds don't seem to work. I am using an Intel(R) Celeron(R) 2955U @ 1.40GHz. I think this is due to me using a repr(simd) hack to obtain better alignment (see ;a=blob;;h=;hb=HEAD
See for previous discussion. I have the same problem. Compiling the following code on my PC with generates executable that exits with SIGILL signal: My compiler and CPU information:
The issue is that Rust will generate code for your CPU family, which is the Haswell family. In theory, AVX is architecturally guaranteed on Haswell, but some CPUs like your Pentium lack it. Could you try compiling with no flags, and then add and confirm that it crashes?
I agree with you. Currently I can’t test your command, but I think it will crash If I enable AVX. Both gcc and clang can , so I think Rust should do it too.

Discussion:
let code_model = to_llvm_code_model(sess.code_model()); <del> let features = attributes::llvm_target_features(sess).collect::<Vec<_>>(); </del> <ins> let mut features = llvm_util::handle_native_features(sess); features.extend(attributes::llvm_target_features(sess).map(|s| s.to_owned())); </ins> let mut singlethread = sess.target.singlethread; // On the wasm target once the `atomics` feature is enabled that means that

PM: &PassManager<'_>, ); <ins> pub fn LLVMGetHostCPUFeatures() -> *mut c_char; pub fn LLVMDisposeMessage(message: *mut c_char); </ins> // Stuff that's in llvm-wrapper/ because it's not upstream yet. /// Opens an object file.

use rustc_session::Session; use rustc_span::symbol::Symbol; use rustc_target::spec::{MergeFunctions, PanicStrategy}; <del> use std::ffi::CString; </del> <ins> use std::ffi::{CStr, CString}; </ins> use std::slice; use std::str;

handle_native(name) } <ins> pub fn handle_native_features(sess: &Session) -> Vec<String> { match sess.opts.cg.target_cpu { Some(ref s) => { if s != "native" { return vec![]; } let features_string = unsafe { let ptr = llvm::LLVMGetHostCPUFeatures(); let features_string = if !ptr.is_null() { CStr::from_ptr(ptr) .to_str() .unwrap_or_else(|e| { bug!("LLVM returned a non-utf8 features string: {}", e); }) .to_owned() } else { bug!("could not allocate host CPU features, LLVM returned a `null` string"); }; llvm::LLVMDisposeMessage(ptr); features_string }; features_string.split(",").map(|s| s.to_owned()).collect() } None => vec![], } } </ins> pub fn tune_cpu(sess: &Session) -> Option<&str> { match sess.opts.debugging_opts.tune_cpu { Some(ref s) => Some(handle_native(&**s)),