Repository: rust
Issue: rust-1.32.0: Could not compile `core` when using system llvm-8.0.0 RC2
Labels: I-crash,A-LLVM,O-linux,T-compiler

In Gentoo Linux, we started to test llvm-8.0.0 RC2. We noticed that rust-1.32 won't build against llvm-8.0.0 RC2. After backporting commit df0466d0bb807a7266cc8ac9931cd43b3e84b62e at least rustc_llvm and rustc_codegen_llvm passed but now, core is failing:

```
 INFO 2019-02-18T03:12:02Z: rustc_mir::build: fn_id DefId(0/0:5977 ~ core[faab]::coresimd[0]::x86_64[0]::rdrand[0]::_rdseed64_step[0]) has attrs Borrowed([Attribute { id: AttrId(42618), style: Outer, path: path(doc), tokens: TokenStream { kind: Stream([TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:28:1: 28:80, Eq)) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:28:1: 28:80, Literal(Str_(/// Read a 64-bit NIST SP800-90B and SP800-90C compliant random value and store), None))) }]) }, is_sugared_doc: true, span: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:28:1: 28:80 }, Attribute { id: AttrId(42619), style: Outer, path: path(doc), tokens: TokenStream { kind: Stream([TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:29:1: 29:71, Eq)) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:29:1: 29:71, Literal(Str_(/// in val. Return 1 if a random value was generated, and 0 otherwise.), None))) }]) }, is_sugared_doc: true, span: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:29:1: 29:71 }, Attribute { id: AttrId(42620), style: Outer, path: path(doc), tokens: TokenStream { kind: Stream([TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:30:1: 30:4, Eq)) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:30:1: 30:4, Literal(Str_(///), None))) }]) }, is_sugared_doc: true, span: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:30:1: 30:4 }, Attribute { id: AttrId(42621), style: Outer, path: path(doc), tokens: TokenStream { kind: Stream([TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:31:1: 31:111, Eq)) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:31:1: 31:111, Literal(Str_(/// [Intel\'s documentation](https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_rdseed64_step)), None))) }]) }, is_sugared_doc: true, span: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:31:1: 31:111 }, Attribute { id: AttrId(42622), style: Outer, path: path(inline), tokens: TokenStream { kind: Empty }, is_sugared_doc: false, span: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:32:1: 32:10 }, Attribute { id: AttrId(42623), style: Outer, path: path(target_feature), tokens: TokenStream { kind: Tree(Delimited(DelimSpan { open: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:33:17: 33:18, close: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:33:35: 33:36 }, Delimited { delim: Paren, tts: ThinTokenStream(Some([TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:33:18: 33:24, Ident(enable#0, false))) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:33:25: 33:26, Eq)) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:33:27: 33:35, Literal(Str_(rdseed), None))) }])) })) }, is_sugared_doc: false, span: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:33:1: 33:37 }, Attribute { id: AttrId(42625), style: Outer, path: path(stable), tokens: TokenStream { kind: Tree(Delimited(DelimSpan { open: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:9: 35:10, close: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:48: 35:49 }, Delimited { delim: Paren, tts: ThinTokenStream(Some([TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:10: 35:17, Ident(feature#0, false))) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:18: 35:19, Eq)) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:20: 35:30, Literal(Str_(simd_x86), None))) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:30: 35:31, Comma)) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:32: 35:37, Ident(since#0, false))) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:38: 35:39, Eq)) }, TokenStream { kind: Tree(Token(src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:40: 35:48, Literal(Str_(1.27.0), None))) }])) })) }, is_sugared_doc: false, span: src/libcore/../stdsimd/coresimd/x86_64/rdrand.rs:35:1: 35:50 }])
 INFO 2019-02-18T03:12:03Z: rustc_save_analysis: Dumping crate core
 INFO 2019-02-18T03:12:03Z: rustc_save_analysis: Writing output to /var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/save-analysis/libcore-a33876dd01369f78.json
 INFO 2019-02-18T03:12:09Z: cargo::core::compiler::job_queue: end: core v0.0.0 (/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/src/libcore) => Target(lib)/Profile(release) => Target
DEBUG 2019-02-18T03:12:09Z: cargo: exit_with_error; err=CliError { error: Some(ProcessError { desc: "process didn\'t exit successfully: `/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/build/bootstrap/debug/rustc --crate-name core src/libcore/lib.rs --color always --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 -C metadata=a33876dd01369f78 -C extra-filename=-a33876dd01369f78 --out-dir /var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/build/x86_64-unknown-linux-gnu/stage1-std/release/deps` (signal: 11, SIGSEGV: invalid memory reference)", exit: Some(ExitStatus(ExitStatus(139))), output: None }

stack backtrace:
   0:     0x564f44cc0fbd - backtrace::backtrace::trace::h7c9932eb13d3dfdc
   1:     0x564f44cbf982 - backtrace::capture::Backtrace::new_unresolved::h78000998b5605dc1
   2:     0x564f44cbf5b5 - failure::backtrace::internal::InternalBacktrace::new::hc2a294bb7e196ce2
   3:     0x564f44cbf1d1 - <failure::backtrace::Backtrace as core::default::Default>::default::h8191b8bf5187674a
   4:     0x564f44cbf209 - failure::backtrace::Backtrace::new::h0c102655b6a92d06
   5:     0x564f448f2b0c - cargo::util::process_builder::ProcessBuilder::exec_with_streaming::h8f9b643f5a3963e1
   6:     0x564f44a15b42 - cargo::core::compiler::Executor::exec_json::h3681d0a586c5b617
   7:     0x564f44a1293a - <F as cargo::core::compiler::job::FnBox<A, R>>::call_box::h3c61d508c5b85b14
   8:     0x564f448a2d9e - <F as cargo::core::compiler::job::FnBox<A, R>>::call_box::ha0055cfba8e2fd59
   9:     0x564f448a2d9e - <F as cargo::core::compiler::job::FnBox<A, R>>::call_box::ha0055cfba8e2fd59
  10:     0x564f448a2e6b - cargo::core::compiler::job::Job::run::hcbfbbbf689ae72ea
  11:     0x564f4480620b - <F as crossbeam_utils::thread::FnBox<T>>::call_box::h3c70c36fd9b941e0
  12:     0x564f44f2ff49 - __rust_maybe_catch_panic
                        at libpanic_unwind/lib.rs:102
  13:     0x564f4480586c - <F as alloc::boxed::FnBox<A>>::call_box::h5a84c77f8bb490fe
  14:     0x564f44f19ded - <alloc::boxed::Box<(dyn alloc::boxed::FnBox<A, Output=R> + 'a)> as core::ops::function::FnOnce<A>>::call_once::h9d902c911a417e39
                        at liballoc/boxed.rs:682
                         - std::sys_common::thread::start_thread::h44127e03e78ca137
                        at libstd/sys_common/thread.rs:24
  15:     0x564f44f06515 - std::sys::unix::thread::Thread::new::thread_start::h8f17b97f2223146c
                        at libstd/sys/unix/thread.rs:90
  16:     0x7f4ac215f3f2 - start_thread
                        at /var/tmp/portage/sys-libs/glibc-2.28-r5/work/glibc-2.28/nptl/pthread_create.c:486
  17:     0x7f4ac20704ae - __clone
  18:                0x0 - <unknown>

stack backtrace:
   0:     0x564f44cc0fbd - backtrace::backtrace::trace::h7c9932eb13d3dfdc
   1:     0x564f44cbf982 - backtrace::capture::Backtrace::new_unresolved::h78000998b5605dc1
   2:     0x564f44cbf5b5 - failure::backtrace::internal::InternalBacktrace::new::hc2a294bb7e196ce2
   3:     0x564f44cbf1d1 - <failure::backtrace::Backtrace as core::default::Default>::default::h8191b8bf5187674a
   4:     0x564f44cbf209 - failure::backtrace::Backtrace::new::h0c102655b6a92d06
   5:     0x564f448e2495 - <core::result::Result<T, E> as cargo::util::errors::CargoResultExt<T, E>>::chain_err::h54dd35d3e7c5d3b5
   6:     0x564f44a1295a - <F as cargo::core::compiler::job::FnBox<A, R>>::call_box::h3c61d508c5b85b14
   7:     0x564f448a2d9e - <F as cargo::core::compiler::job::FnBox<A, R>>::call_box::ha0055cfba8e2fd59
   8:     0x564f448a2d9e - <F as cargo::core::compiler::job::FnBox<A, R>>::call_box::ha0055cfba8e2fd59
   9:     0x564f448a2e6b - cargo::core::compiler::job::Job::run::hcbfbbbf689ae72ea
  10:     0x564f4480620b - <F as crossbeam_utils::thread::FnBox<T>>::call_box::h3c70c36fd9b941e0
  11:     0x564f44f2ff49 - __rust_maybe_catch_panic
                        at libpanic_unwind/lib.rs:102
  12:     0x564f4480586c - <F as alloc::boxed::FnBox<A>>::call_box::h5a84c77f8bb490fe
  13:     0x564f44f19ded - <alloc::boxed::Box<(dyn alloc::boxed::FnBox<A, Output=R> + 'a)> as core::ops::function::FnOnce<A>>::call_once::h9d902c911a417e39
                        at liballoc/boxed.rs:682
                         - std::sys_common::thread::start_thread::h44127e03e78ca137
                        at libstd/sys_common/thread.rs:24
  14:     0x564f44f06515 - std::sys::unix::thread::Thread::new::thread_start::h8f17b97f2223146c
                        at libstd/sys/unix/thread.rs:90
  15:     0x7f4ac215f3f2 - start_thread
                        at /var/tmp/portage/sys-libs/glibc-2.28-r5/work/glibc-2.28/nptl/pthread_create.c:486
  16:     0x7f4ac20704ae - __clone
  17:                0x0 - <unknown>

Could not compile `core`.), unknown: false, exit_code: 101 }
error: Could not compile `core`.

To learn more, run the command again with --verbose.
command did not execute successfully: "/var/tmp/portage/dev-lang/rust-1.32.0/work/rust-stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "6" "--release" "--locked" "--frozen" "--features" "panic-unwind backtrace" "--manifest-path" "/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
Traceback (most recent call last):
  File "./x.py", line 20, in <module>
    bootstrap.main()
  File "/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/src/bootstrap/bootstrap.py", line 853, in main
    bootstrap(help_triggered)
  File "/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/src/bootstrap/bootstrap.py", line 839, in bootstrap
    run(args, env=env, verbose=build.verbose)
  File "/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/src/bootstrap/bootstrap.py", line 151, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/build/bootstrap/debug/bootstrap build --verbose --config=/var/tmp/portage/dev-lang/rust-1.32.0/work/rustc-1.32.0-src/config.toml -j6 --exclude src/tools/miri
```
Are we missing another patch?