Skip to content

rg crashes with -C target-cpu=native on Xeon E5-2670  #36677

Closed
@brson

Description

@brson

If I RUSTFLAGS="-C target-cpu=native" cargo install ripgrep then run rg --version it crashes with an illegal instruction.

rg version is 0.1.17, rustc is rustc 1.13.0-nightly (4f9812a59 2016-09-21).

Starting program: /home/brian/.cargo/bin/rg --version
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction.
0x0000555555594fec in collections::slice::hack::into_vec<collections::string::String> (b=<error reading variable: access outside bounds of object referenced via synthetic pointer>)
    at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/slice.rs:140
140     /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/slice.rs: No such file or directory.
(gdb) bt
#0  0x0000555555594fec in collections::slice::hack::into_vec<collections::string::String> (b=<error reading variable: access outside bounds of object referenced via synthetic pointer>)
    at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/slice.rs:140
#1  collections::slice::{{impl}}::into_vec<collections::string::String> (self=<error reading variable: access outside bounds of object referenced via synthetic pointer>)
    at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/slice.rs:1165
#2  rg::args::{{impl}}::parse () at /home/brian/.cargo/registry/src/github.com-1ecc6299db9ec823/ripgrep-0.1.17/src/args.rs:442
#3  rg::main () at /home/brian/.cargo/registry/src/github.com-1ecc6299db9ec823/ripgrep-0.1.17/src/main.rs:77
#4  0x0000555555663597 in __rust_maybe_catch_panic ()
#5  0x000055555565a1cc in std::rt::lang_start::haaae1186de9de8cb ()
#6  0x00007ffff73f7830 in __libc_start_main (main=0x5555555a8a60 <main>, argc=2, argv=0x7fffffffe238, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7fffffffe228) at ../csu/libc-start.c:291
#7  0x0000555555568369 in _start ()
(gdb) x/10i $pc
=> 0x555555594fec <rg::main+28>:        vxorps %xmm0,%xmm0,%xmm0
   0x555555594ff0 <rg::main+32>:        vmovups %xmm0,-0x48(%rbp)
   0x555555594ff5 <rg::main+37>:        lea    -0x9a8(%rbp),%rdi
   0x555555594ffc <rg::main+44>:        callq  0x55555564f480 <_ZN3std3env7args_os17h56ed1cad6d6fff07E>
   0x555555595001 <rg::main+49>:        vmovups -0x9a8(%rbp),%xmm0
   0x555555595009 <rg::main+57>:        vmovups -0x998(%rbp),%xmm1
   0x555555595011 <rg::main+65>:        vmovaps %xmm1,-0x70(%rbp)
   0x555555595016 <rg::main+70>:        vmovaps %xmm0,-0x80(%rbp)
   0x55555559501b <rg::main+75>:        xor    %r15d,%r15d
   0x55555559501e <rg::main+78>:        mov    $0x1,%r12d
$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping        : 4
microcode       : 0x415
cpu MHz         : 2500.096
cache size      : 25600 KB
physical id     : 1
siblings        : 4
core id         : 0
cpu cores       : 1
apicid          : 32
initial apicid  : 32
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu de tsc msr pae cx8 apic sep cmov pat clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt tsc_deadline_timer aes rdrand hypervisor lahf_lm epb fsgsbase erms dtherm ida arat pln pts
bugs            :
bogomips        : 5000.19
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

Seems like rustc is using avx2 when it doesn't exist. cc @BurntSushi

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions